Skip to content

Commit c81e05e

Browse files
committed
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>
1 parent 890dcca commit c81e05e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cli/command/stack/deploy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ func newDeployCommand(dockerCLI command.Cli) *cobra.Command {
5151

5252
flags := cmd.Flags()
5353
flags.StringSliceVarP(&opts.composefiles, "compose-file", "c", []string{}, `Path to a Compose file, or "-" to read from stdin`)
54-
flags.SetAnnotation("compose-file", "version", []string{"1.25"})
54+
_ = flags.SetAnnotation("compose-file", "version", []string{"1.25"})
55+
// Provide tab-completion for filenames. On Bash, this is constrained to the
56+
// ".yaml" and ".yml" file-extensions, but this doesn't appear to be supported
57+
// by other shells.
58+
_ = cmd.MarkFlagFilename("compose-file", "yaml", "yml")
59+
5560
flags.BoolVar(&opts.sendRegistryAuth, "with-registry-auth", false, "Send registry authentication details to Swarm agents")
5661
flags.BoolVar(&opts.prune, "prune", false, "Prune services that are no longer referenced")
5762
flags.SetAnnotation("prune", "version", []string{"1.27"})

0 commit comments

Comments
 (0)