Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Don’t show inherited flags in dagger call <function> --help #7400

Closed
helderco opened this issue May 17, 2024 · 1 comment · Fixed by #7419
Closed

CLI: Don’t show inherited flags in dagger call <function> --help #7400

helderco opened this issue May 17, 2024 · 1 comment · Fixed by #7419
Assignees

Comments

@helderco
Copy link
Contributor

helderco commented May 17, 2024

Follow-up to:

In dagger call --help there’s three groups of flags:

  • Module constructor arguments
  • call specific flags
  • Global flags

Example:

ARGUMENTS
      --source Directory            [required]
      --host-docker-config Secret
      --version string

OPTIONS
      --json            Present result as JSON
  -m, --mod string      Path to dagger.json config file for the module or a directory containing that file.
                        Either local path (e.g. "/path/to/some/dir") or a github repo (e.g.
                        "github.com/dagger/dagger/path/to/some/subdir")
  -o, --output string   Path in the host to save the result to

INHERITED OPTIONS
  -d, --debug             show debug logs and full verbosity
      --progress string   progress output format (auto, plain, tty) (default "auto")
  -s, --silent            disable terminal UI and progress output
  -v, --verbose count     increase verbosity (use -vv or -vvv for more)

But in any function command, we don’t need to show all the inherited flags again. Some of those are global and have already been parsed already:

ARGUMENTS
      --directory Directory   Identifier of the directory to copy. [required]
      --path string           Location of the written directory (e.g., "/src/"). [required]
      --exclude strings       Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
      --include strings       Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).

INHERITED OPTIONS
  -d, --debug             show debug logs and full verbosity
      --json              Present result as JSON
  -m, --mod string        Path to dagger.json config file for the module or a directory containing that
                          file. Either local path (e.g. "/path/to/some/dir") or a github repo (e.g.
                          "github.com/dagger/dagger/path/to/some/subdir")
  -o, --output string     Path in the host to save the result to
      --progress string   progress output format (auto, plain, tty) (default "auto")
  -s, --silent            disable terminal UI and progress output
  -v, --verbose count     increase verbosity (use -vv or -vvv for more)

We should only show the function arguments, but a VisitAll on the cmd.PersistentFlags() to hide those flags doesn’t work. On a preliminary debug session, they don’t seem to be coming from the persistent flagset:

  -, --api [https://api.dagger.cloud]  https://api.dagger.cloud   [L]
  -d, --debug [false]  false   [L]
  -h, --help [false]  true   [L]
  -, --id []     [L]
  -, --json [false]  false   [L]
  -m, --mod []  -   [L]
  -o, --output []     [L]
  -, --platform []     [L]
  -, --progress [auto]  auto   [L]
  -s, --silent [false]  false   [L]
  -v, --verbose [0]  0   [L]
  -, --workdir [.]  /Users/.../dagger   [L]
@helderco helderco added kind/dx Issue affects the Dagger developer experience: cue syntax, APIs, etc area/cli All about go code on dagger CLI labels May 17, 2024
@helderco helderco self-assigned this May 20, 2024
@helderco
Copy link
Contributor Author

I resolved with an annotation in:

@samalba samalba removed kind/dx Issue affects the Dagger developer experience: cue syntax, APIs, etc area/cli All about go code on dagger CLI labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants