Skip to content

Commit dfa98d3

Browse files
authored
Merge pull request #6690 from thaJeztah/compose_file_completion
add shell completion for "docker stack deploy --compose-file"
2 parents 890dcca + c81e05e commit dfa98d3

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)