Skip to content

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

@ykmchd

Description

@ykmchd

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

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions