ITADN

helm secrets -v outputs --version option description in addition to version number

#737Openykmchd 创建于 2026-04-04
bug
Y
ykmchdcommented
### Current Behavior Running helm secrets -v outputs the version number followed by an unexpected extra line: ``` ❯ helm secrets -v 4.7.5 --version -v Display version of helm-secrets ``` ### Expected Behavior Only the version number should be printed: ``` ❯ helm secrets -v 4.7.5 ``` ### Steps To Reproduce ```markdown 1. Install helm-secrets with Helm 4: helm plugin install https://github.com/jkroepke/helm-secrets/releases/download/v4.7.5/secrets-4.7.5.tgz 2. Run helm secrets -v ``` ### Environment - Helm Version: v4.1.3 - Helm Secrets Version: 4.7.5 - OS: macOS 26.4 / Ubuntu 24.04.4 LTS (both reproduced) - Shell: zsh ### Anything else? Root Cause scripts/commands/version.sh extracts the version with: ``` grep version "${SCRIPT_DIR}/../plugin.yaml" | cut -d'"' -f2 ``` This command was written against the Helm 3 plugin.yaml format (repository root), where grep version matches only one line: version: "4.7.5" Since Helm 4 CLI v1 support was added, the release workflow (release.yaml) packages plugins/helm-secrets-cli/plugin.yaml as the installed plugin.yaml. The CLI v1 format includes a longHelp field containing the text --version: ``` version: "4.7.5" ... longHelp: | ... --version -v Display version of helm-secrets ``` As a result, grep version now matches two lines. The second line contains no " characters. The POSIX-conformant behavior of cut when no delimiter is found is to output the entire line, which is consistent across both GNU cut (Linux) and BSD cut (macOS): ``` $ echo ' --version -v Display version of helm-secrets' | cut -d'"' -f2 --version -v Display version of helm-secrets ``` Proposed Fix Anchor the grep pattern to match only the version: field at the start of the line: ``` # scripts/commands/version.sh version() { grep '^version:' "${SCRIPT_DIR}/../plugin.yaml" | cut -d'"' -f2 } ```
0 条评论