Skip to content

Commit

Permalink
jj_completer: Updated completer for v0.17.0
Browse files Browse the repository at this point in the history
	- added `--insert-after` and `--insert-before` to `jj rebase`
	- renamed `--revision` to `--revisions` in `jj rebase`
	- Added global flag `--ignore-immutable`
	- `jj status` now accepts any number of paths as positional arguments
	- added `--use-destination-message` to `jj squash`
  • Loading branch information
aftix committed May 6, 2024
1 parent db6ff6b commit c024e19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions completers/jj_completer/cmd/rebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ 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()),
"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)
}

0 comments on commit c024e19

Please sign in to comment.