From fb16916470cabcdf119a9541b3d57aeb21e21701 Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 4 Feb 2024 14:31:03 +0100 Subject: [PATCH] git: alias - support external commands --- completers/git_completer/cmd/blame.go | 2 +- pkg/actions/tools/git/config.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/completers/git_completer/cmd/blame.go b/completers/git_completer/cmd/blame.go index a7c5c1d4ac..5429e94251 100644 --- a/completers/git_completer/cmd/blame.go +++ b/completers/git_completer/cmd/blame.go @@ -18,7 +18,7 @@ var blameCmd = &cobra.Command{ func init() { carapace.Gen(blameCmd).Standalone() - blameCmd.Flags().StringS("C", "C", "", "find line copies within and across files") + blameCmd.Flags().StringSliceS("C", "C", []string{}, "find line copies within and across files") blameCmd.Flags().StringS("L", "L", "", "process only line range , or function :") blameCmd.Flags().StringS("M", "M", "", "find line movements within and across files") blameCmd.Flags().StringS("S", "S", "", "use revisions from instead of calling git-rev-list") diff --git a/pkg/actions/tools/git/config.go b/pkg/actions/tools/git/config.go index f00a37a624..5b956d9175 100644 --- a/pkg/actions/tools/git/config.go +++ b/pkg/actions/tools/git/config.go @@ -374,6 +374,7 @@ func ActionConfigValues(config string) carapace.Action { "fetch.recurseSubmodules": carapace.ActionValues("true", "false", "ondemand").StyleF(style.ForKeyword), "fetch.showForcedUpdates": _bool, "fetch.writeCommitGraph": _bool, + "rerere.enabled": _bool, "remote.pushDefault": ActionRemotes(), }[config]); ok { return a @@ -382,7 +383,12 @@ func ActionConfigValues(config string) carapace.Action { splitted := strings.Split(config, ".") switch splitted[0] { case "alias": - return bridge.ActionCarapaceBin("git").Split() + return carapace.Batch( + bridge.ActionCarapaceBin().Split().Prefix("!").Unless(func(c carapace.Context) bool { + return !strings.HasPrefix(c.Value, "!") + }), + bridge.ActionCarapaceBin("git").Split(), + ).ToA() case "branch": switch len(splitted) { case 3: