Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jj_completer: Updated completer for v0.17.0 #2377

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions completers/jj_completer/cmd/rebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ var rebaseCmd = &cobra.Command{
func init() {
carapace.Gen(rebaseCmd).Standalone()

rebaseCmd.Flags().StringArray("after", []string{}, "Alias for `--insert-after`")
rebaseCmd.Flags().StringArray("before", []string{}, "Alias for `--insert-before`")
rebaseCmd.Flags().StringSliceP("branch", "b", []string{}, "Rebase the whole branch relative to destination's ancestors (can be repeated)")
rebaseCmd.Flags().StringSliceP("destination", "d", []string{}, "The revision(s) to rebase onto (can be repeated to create a merge commit)")
rebaseCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
rebaseCmd.Flags().StringP("revision", "r", "", "Rebase only this revision, rebasing descendants onto this revision's parent(s)")
rebaseCmd.Flags().StringArrayP("insert-after", "A", []string{}, "Revision(s) to insert after")
rebaseCmd.Flags().StringArrayP("insert-before", "B", []string{}, "Revision(s) to insert before")
rebaseCmd.Flags().StringP("revisions", "r", "", "Rebase only this revision, rebasing descendants onto this revision's parent(s)")
rebaseCmd.Flags().StringSliceP("source", "s", []string{}, "Rebase specified revision(s) together their tree of descendants (can be repeated)")
rebaseCmd.MarkFlagRequired("destination")
rootCmd.AddCommand(rebaseCmd)

carapace.Gen(rebaseCmd).FlagCompletion(carapace.ActionMap{
"branch": jj.ActionRevs(jj.RevOption{LocalBranches: true, RemoteBranches: true, Tags: true}),
"destination": jj.ActionRevs(jj.RevOption{}.Default()),
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
"source": jj.ActionRevs(jj.RevOption{}.Default()),
"after": jj.ActionRevs(jj.RevOption{}.Default()),
"before": jj.ActionRevs(jj.RevOption{}.Default()),
"branch": jj.ActionRevs(jj.RevOption{LocalBranches: true, RemoteBranches: true, Tags: true}),
"destination": jj.ActionRevs(jj.RevOption{}.Default()),
"insert-after": jj.ActionRevs(jj.RevOption{}.Default()),
"insert-before": jj.ActionRevs(jj.RevOption{}.Default()),
"revisions": jj.ActionRevs(jj.RevOption{}.Default()),
"source": jj.ActionRevs(jj.RevOption{}.Default()),
})
}
1 change: 1 addition & 0 deletions completers/jj_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func init() {
rootCmd.PersistentFlags().String("color", "", "When to colorize output (always, never, auto)")
rootCmd.PersistentFlags().StringSlice("config-toml", []string{}, "Additional configuration options (can be repeated)")
rootCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
rootCmd.PersistentFlags().Bool("ignore-immutable", false, "Allow rewriting of immutable commits")
rootCmd.PersistentFlags().Bool("ignore-working-copy", false, "Don't snapshot the working copy, and don't update it")
rootCmd.PersistentFlags().Bool("no-pager", false, "Disable the pager")
rootCmd.PersistentFlags().Bool("quiet", false, "Silence non-primary output")
Expand Down
1 change: 1 addition & 0 deletions completers/jj_completer/cmd/squash.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func init() {
squashCmd.Flags().StringP("revision", "r", "@", "Revision to squash into its parent")
squashCmd.Flags().String("to", "@", "Revision to squash into (alias for --into)")
squashCmd.Flags().String("tool", "", "Specify diff editor to use (implies --interactive)")
squashCmd.Flags().BoolP("use-destination-message", "u", false, "Use the description of the destination revision for the new squashed revision")

squashCmd.MarkFlagsMutuallyExclusive("revision", "into", "to")
squashCmd.MarkFlagsMutuallyExclusive("revision", "from")
Expand Down
3 changes: 3 additions & 0 deletions completers/jj_completer/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ func init() {
carapace.Gen(statusCmd).Standalone()

statusCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")

carapace.Gen(statusCmd).PositionalAnyCompletion(carapace.ActionFiles())

rootCmd.AddCommand(statusCmd)
}