diff --git a/completers/git_completer/cmd/interpretTrailers.go b/completers/git_completer/cmd/interpretTrailers.go new file mode 100644 index 0000000000..e86e607b17 --- /dev/null +++ b/completers/git_completer/cmd/interpretTrailers.go @@ -0,0 +1,39 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var interpretTrailerCmd = &cobra.Command{ + Use: "interpret-trailer", + Short: "Add or parse structured information in commit messages", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_low_level_helper].ID, +} + +func init() { + carapace.Gen(interpretTrailerCmd).Standalone() + + interpretTrailerCmd.Flags().String("if-exists", "", "action if trailer already exists") + interpretTrailerCmd.Flags().Bool("in-place", false, "edit files in place") + interpretTrailerCmd.Flags().Bool("no-divider", false, "do not treat --- specially") + interpretTrailerCmd.Flags().Bool("only-input", false, "do not apply config rules") + interpretTrailerCmd.Flags().Bool("only-trailers", false, "output only the trailers") + interpretTrailerCmd.Flags().Bool("parse", false, "set parsing options") + interpretTrailerCmd.Flags().String("trailer", "", "trailer(s) to add") + interpretTrailerCmd.Flags().Bool("trim-empty", false, "trim empty trailers") + interpretTrailerCmd.Flags().Bool("unfold", false, "join whitespace-continued values") + interpretTrailerCmd.Flags().String("where", "", "where to place the new trailer") + rootCmd.AddCommand(interpretTrailerCmd) + + carapace.Gen(interpretTrailerCmd).FlagCompletion(carapace.ActionMap{ + "if-exists": carapace.ActionValues("addIfDifferent", "addIfDifferentNeighbor", "add", "replace", "doNothing"), + "trailer": carapace.ActionValues("doNothing", "add"), + "where": carapace.ActionValues("after", "before", "end", "start"), + }) + + carapace.Gen(interpretTrailerCmd).PositionalAnyCompletion( + carapace.ActionFiles(), + ) +} diff --git a/completers/git_completer/cmd/interpret_trailers_generated.go b/completers/git_completer/cmd/interpret_trailers_generated.go deleted file mode 100644 index 8173a24fda..0000000000 --- a/completers/git_completer/cmd/interpret_trailers_generated.go +++ /dev/null @@ -1,29 +0,0 @@ -package cmd - -import ( - "github.com/rsteube/carapace" - "github.com/spf13/cobra" -) - -var interpret_trailersCmd = &cobra.Command{ - Use: "interpret-trailers", - Short: "Add or parse structured information in commit messages", - Run: func(cmd *cobra.Command, args []string) {}, - GroupID: groups[group_low_level_helper].ID, -} - -func init() { - carapace.Gen(interpret_trailersCmd).Standalone() - interpret_trailersCmd.Flags().String("if-exists", "", "action if trailer already exists") - interpret_trailersCmd.Flags().String("if-missing", "", "action if trailer is missing") - interpret_trailersCmd.Flags().Bool("in-place", false, "edit files in place") - interpret_trailersCmd.Flags().Bool("no-divider", false, "do not treat --- specially") - interpret_trailersCmd.Flags().Bool("only-input", false, "do not apply config rules") - interpret_trailersCmd.Flags().Bool("only-trailers", false, "output only the trailers") - interpret_trailersCmd.Flags().Bool("parse", false, "set parsing options") - interpret_trailersCmd.Flags().String("trailer", "", "trailer(s) to add") - interpret_trailersCmd.Flags().Bool("trim-empty", false, "trim empty trailers") - interpret_trailersCmd.Flags().Bool("unfold", false, "join whitespace-continued values") - interpret_trailersCmd.Flags().String("where", "", "where to place the new trailer") - rootCmd.AddCommand(interpret_trailersCmd) -}