mirror of
https://github.com/docker/cli.git
synced 2026-01-26 15:41:42 +03:00
add shell completion for "docker stack deploy --compose-file"
With this patch:
docker stack deploy -c<TAB>
.codecov.yml contrib/ e2e/ pkg/
.git/ build/ debian/ experimental/
...
docker stack deploy -c contrib/otel/<TAB>
compose.yaml otelcol.yaml prom.yaml
Note that filtering for the file-extension only appears to be functional
on bash, but not (currently) working on other shells (at least not on Fish).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -51,7 +51,12 @@ func newDeployCommand(dockerCLI command.Cli) *cobra.Command {
|
||||
|
||||
flags := cmd.Flags()
|
||||
flags.StringSliceVarP(&opts.composefiles, "compose-file", "c", []string{}, `Path to a Compose file, or "-" to read from stdin`)
|
||||
flags.SetAnnotation("compose-file", "version", []string{"1.25"})
|
||||
_ = flags.SetAnnotation("compose-file", "version", []string{"1.25"})
|
||||
// Provide tab-completion for filenames. On Bash, this is constrained to the
|
||||
// ".yaml" and ".yml" file-extensions, but this doesn't appear to be supported
|
||||
// by other shells.
|
||||
_ = cmd.MarkFlagFilename("compose-file", "yaml", "yml")
|
||||
|
||||
flags.BoolVar(&opts.sendRegistryAuth, "with-registry-auth", false, "Send registry authentication details to Swarm agents")
|
||||
flags.BoolVar(&opts.prune, "prune", false, "Prune services that are no longer referenced")
|
||||
flags.SetAnnotation("prune", "version", []string{"1.27"})
|
||||
|
||||
Reference in New Issue
Block a user