From a0a28ebccb498eb49b8ce03bb5dd1f17904d8774 Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 15 Aug 2024 10:59:54 +0200 Subject: [PATCH] git: commit-tree --- completers/git_completer/cmd/commitTree.go | 38 +++++++++++++++++++ .../cmd/commit_tree_generated.go | 22 ----------- 2 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 completers/git_completer/cmd/commitTree.go delete mode 100644 completers/git_completer/cmd/commit_tree_generated.go diff --git a/completers/git_completer/cmd/commitTree.go b/completers/git_completer/cmd/commitTree.go new file mode 100644 index 0000000000..bb59a0506a --- /dev/null +++ b/completers/git_completer/cmd/commitTree.go @@ -0,0 +1,38 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/carapace-sh/carapace-bin/pkg/actions/os" + "github.com/carapace-sh/carapace-bin/pkg/actions/tools/git" + "github.com/spf13/cobra" +) + +var commitTreeCmd = &cobra.Command{ + Use: "commit-tree", + Short: "Create a new commit object", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_low_level_manipulator].ID, +} + +func init() { + carapace.Gen(commitTreeCmd).Standalone() + + commitTreeCmd.Flags().StringS("F", "F", "", "read commit log message from file") + commitTreeCmd.Flags().StringP("gpg-sign", "S", "", "GPG sign commit") + commitTreeCmd.Flags().StringS("m", "m", "", "commit message") + commitTreeCmd.Flags().Bool("no-gpg-sign", false, "do not GPG sign commit") + commitTreeCmd.Flags().StringSliceS("p", "p", nil, "id of a parent commit object") + rootCmd.AddCommand(commitTreeCmd) + + commitTreeCmd.Flag("gpg-sign").NoOptDefVal = " " + + carapace.Gen(commitTreeCmd).FlagCompletion(carapace.ActionMap{ + "F": carapace.ActionFiles(), + "gpg-sign": os.ActionGpgKeyIds(), + "p": git.ActionRefs(git.RefOption{}.Default()), // TODO what are valid parents? + }) + + carapace.Gen(commitTreeCmd).PositionalCompletion( + git.ActionRefs(git.RefOption{}.Default()), // TODO what's a tree object? + ) +} diff --git a/completers/git_completer/cmd/commit_tree_generated.go b/completers/git_completer/cmd/commit_tree_generated.go deleted file mode 100644 index c1403c1127..0000000000 --- a/completers/git_completer/cmd/commit_tree_generated.go +++ /dev/null @@ -1,22 +0,0 @@ -package cmd - -import ( - "github.com/carapace-sh/carapace" - "github.com/spf13/cobra" -) - -var commit_treeCmd = &cobra.Command{ - Use: "commit-tree", - Short: "Create a new commit object", - Run: func(cmd *cobra.Command, args []string) {}, - GroupID: groups[group_low_level_manipulator].ID, -} - -func init() { - carapace.Gen(commit_treeCmd).Standalone() - commit_treeCmd.Flags().StringS("F", "F", "", "read commit log message from file") - commit_treeCmd.Flags().StringP("gpg-sign", "S", "", "GPG sign commit") - commit_treeCmd.Flags().StringS("m", "m", "", "commit message") - commit_treeCmd.Flags().StringS("p", "p", "", "id of a parent commit object") - rootCmd.AddCommand(commit_treeCmd) -}