Skip to content

Commit

Permalink
git: alias - support external commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Feb 4, 2024
1 parent 8199516 commit fb16916
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion completers/git_completer/cmd/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <start>,<end> or function :<funcname>")
blameCmd.Flags().StringS("M", "M", "", "find line movements within and across files")
blameCmd.Flags().StringS("S", "S", "", "use revisions from <file> instead of calling git-rev-list")
Expand Down
8 changes: 7 additions & 1 deletion pkg/actions/tools/git/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit fb16916

Please sign in to comment.