Skip to content

Commit

Permalink
Merge pull request #1072 from rsteube/tig-preinvoke
Browse files Browse the repository at this point in the history
tig: use preinvoke
  • Loading branch information
rsteube authored Apr 29, 2022
2 parents af5621a + 94244d0 commit 58c6747
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion completers/tig_completer/cmd/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
carapace.Gen(blameCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
c.Args = append([]string{"blame"}, c.Args...)
return git.ActionExecute().Chdir(blameCmd.Root().Flag("C").Value.String()).Invoke(c).ToA()
return git.ActionExecute().Invoke(c).ToA()
}),
)
}
2 changes: 1 addition & 1 deletion completers/tig_completer/cmd/grep.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
carapace.Gen(grepCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
c.Args = append([]string{"grep"}, c.Args...)
return git.ActionExecute().Chdir(grepCmd.Root().Flag("C").Value.String()).Invoke(c).ToA()
return git.ActionExecute().Invoke(c).ToA()
}),
)
}
2 changes: 1 addition & 1 deletion completers/tig_completer/cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
carapace.Gen(logCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
c.Args = append([]string{"log"}, c.Args...)
return git.ActionExecute().Chdir(logCmd.Root().Flag("C").Value.String()).Invoke(c).ToA()
return git.ActionExecute().Invoke(c).ToA()
}),
)
}
4 changes: 1 addition & 3 deletions completers/tig_completer/cmd/reflog.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ func init() {
rootCmd.AddCommand(reflogCmd)

carapace.Gen(reflogCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionRefs(git.RefOptionDefault).Chdir(grepCmd.Root().Flag("C").Value.String())
}),
git.ActionRefs(git.RefOptionDefault),
)
}
4 changes: 1 addition & 3 deletions completers/tig_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ func init() {
})

carapace.Gen(rootCmd).PositionalCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionRefs(git.RefOptionDefault).Chdir(rootCmd.Flag("C").Value.String())
}),
git.ActionRefs(git.RefOptionDefault),
)

carapace.Gen(rootCmd).PreInvoke(func(cmd *cobra.Command, flag *pflag.Flag, action carapace.Action) carapace.Action {
Expand Down
2 changes: 1 addition & 1 deletion completers/tig_completer/cmd/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
carapace.Gen(showCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
c.Args = append([]string{"show"}, c.Args...)
return git.ActionExecute().Chdir(logCmd.Root().Flag("C").Value.String()).Invoke(c).ToA()
return git.ActionExecute().Invoke(c).ToA()
}),
)
}

0 comments on commit 58c6747

Please sign in to comment.