Skip to content

Commit

Permalink
✨ Add yaml file filter completion
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed May 6, 2022
1 parent 9b6bd53 commit b07e180
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit b07e180

Please sign in to comment.