Skip to content

Commit

Permalink
Merge pull request #2341 from aftix/jj_0.16
Browse files Browse the repository at this point in the history
Updated jujutsu completer to jj v0.16.0
  • Loading branch information
rsteube authored Apr 10, 2024
2 parents c43d622 + 408441e commit 609f2ae
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 4 deletions.
6 changes: 5 additions & 1 deletion completers/jj_completer/cmd/branch_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ var branch_listCmd = &cobra.Command{
func init() {
carapace.Gen(branch_listCmd).Standalone()

branch_listCmd.Flags().BoolP("all", "a", false, "Show all tracking and non-tracking remote branches including the ones whose targets are synchronized with the local branches")
branch_listCmd.Flags().BoolP("all-remotes", "a", false, "Show all tracking and non-tracking remote branches including the ones whose targets are synchronized with the local branches")
branch_listCmd.Flags().BoolP("conflicted", "c", false, "Show only conflicted branches")
branch_listCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
branch_listCmd.Flags().StringSliceP("revisions", "r", []string{}, "Show branches whose local targets are in the given revisions")

branch_listCmd.MarkFlagsMutuallyExclusive("all-remotes", "conflicted")

branchCmd.AddCommand(branch_listCmd)

carapace.Gen(branch_listCmd).FlagCompletion(carapace.ActionMap{
Expand Down
3 changes: 3 additions & 0 deletions completers/jj_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ func init() {
rootCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
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")
rootCmd.PersistentFlags().StringP("repository", "R", "", "Path to repository to operate on")
rootCmd.PersistentFlags().BoolP("verbose", "v", false, "Enable verbose logging")
rootCmd.Flags().BoolP("version", "V", false, "Print version")

rootCmd.MarkFlagsMutuallyExclusive("quiet", "verbose")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"at-operation": carapace.ActionValues(), // TODO
"color": carapace.ActionValues("always", "never", "auto").StyleF(style.ForKeyword),
Expand Down
19 changes: 19 additions & 0 deletions completers/jj_completer/cmd/sparse_edit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var sparse_editCmd = &cobra.Command{
Use: "edit",
Short: "Start an editor to update the patterns that are present in the working copy",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(sparse_editCmd).Standalone()

sparse_editCmd.Flags().BoolP("help", "h", false, "Print help (see a summary with '-h')")
sparseCmd.AddCommand(sparse_editCmd)
}
19 changes: 19 additions & 0 deletions completers/jj_completer/cmd/sparse_reset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var sparse_resetCmd = &cobra.Command{
Use: "reset",
Short: "Reset the patterns to include all files in the working copy",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(sparse_resetCmd).Standalone()

sparse_resetCmd.Flags().BoolP("help", "h", false, "Print help (see a summary with '-h')")
sparseCmd.AddCommand(sparse_resetCmd)
}
2 changes: 0 additions & 2 deletions completers/jj_completer/cmd/sparse_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ func init() {

sparse_setCmd.Flags().StringSlice("add", []string{}, "Patterns to add to the working copy")
sparse_setCmd.Flags().Bool("clear", false, "Include no files in the working copy (combine with --add)")
sparse_setCmd.Flags().Bool("edit", false, "Edit patterns with $EDITOR")
sparse_setCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
sparse_setCmd.Flags().StringSlice("remove", []string{}, "Patterns to remove from the working copy")
sparse_setCmd.Flags().Bool("reset", false, "Include all files in the working copy")
sparseCmd.AddCommand(sparse_setCmd)
}
1 change: 1 addition & 0 deletions completers/jj_completer/cmd/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
splitCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
splitCmd.Flags().BoolP("interactive", "i", false, "Interactively choose which parts to split. This is the default if no paths are provided")
splitCmd.Flags().StringP("revision", "r", "", "The revision to split")
splitCmd.Flags().BoolP("siblings", "s", false, "Split the revision into two siblings instead of parent and child")
rootCmd.AddCommand(splitCmd)

carapace.Gen(splitCmd).FlagCompletion(carapace.ActionMap{
Expand Down
13 changes: 12 additions & 1 deletion completers/jj_completer/cmd/squash.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,25 @@ var squashCmd = &cobra.Command{
func init() {
carapace.Gen(squashCmd).Standalone()

squashCmd.Flags().String("from", "@", "Revision to squash from")
squashCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
squashCmd.Flags().BoolP("interactive", "i", false, "Interactively choose which parts to squash")
squashCmd.Flags().String("into", "@", "Revision to squash into")
squashCmd.Flags().StringSliceP("message", "m", []string{}, "The description to use for squashed revision (don't open editor)")
squashCmd.Flags().StringP("revision", "r", "@", "")
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.MarkFlagsMutuallyExclusive("revision", "into", "to")
squashCmd.MarkFlagsMutuallyExclusive("revision", "from")

rootCmd.AddCommand(squashCmd)

carapace.Gen(squashCmd).FlagCompletion(carapace.ActionMap{
"from": jj.ActionRevs(jj.RevOption{}.Default()),
"into": jj.ActionRevs(jj.RevOption{}.Default()),
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
"to": jj.ActionRevs(jj.RevOption{}.Default()),
})

carapace.Gen(squashCmd).PositionalAnyCompletion(
Expand Down

0 comments on commit 609f2ae

Please sign in to comment.