From b07e180bb183c4b1d40d7961c59f3fadacfde6c2 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Fri, 6 May 2022 14:30:09 -0500 Subject: [PATCH] :sparkles: Add yaml file filter completion --- cmd/cmd.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/cmd.go b/cmd/cmd.go index d9f244f..ee2562b 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -18,6 +18,7 @@ var Command = &cobra.Command{ Short: "Inline YAML templating via line-comments", DisableFlagsInUseLine: true, DisableAutoGenTag: true, + ValidArgsFunction: validArgs, Version: buildVersion(), PreRunE: preRun, RunE: run, @@ -33,6 +34,10 @@ func init() { Command.Flags().StringVar(&conf.RightDelim, "right-delim", "}}", "Override the default right delimiter") } +func validArgs(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"yaml", "yml"}, cobra.ShellCompDirectiveFilterFileExt +} + func preRun(cmd *cobra.Command, args []string) error { if completionFlag != "" { return nil