jj_completer: Updated to jujutsu 0.26.0 (#2703)

* jj_completer: Updated to jujutsu 0.26.0
  - Added flag `--retain-bookmarks` to `jj abandon`
  - Removed flags `--git` and `--git-repo` from `jj init`
  - removed `jj cat`, `jj chmod`, and `jj files`
  - removed short alias `-l` for `--limit` in `jj log`, `jj op`, and `jj op log`
  - removed option `--siblings` in `jj split`
  - replaced command `jj util mangen` with `jj util install-man-pages`, which
    takes a path to install to
  - Added `--edit` option to `jj describe`
  - Added `--reversed` option to `jj evolog` and `jj op log`
  - Added `--interactive/-i` option to `jj restore`
  - Added `--tool` option to `jj commit` and `jj restore`
  - Added `--into` option for `jj restore`

* jj: added tool completion

* jj: restore - added into completion

---------

Co-authored-by: rsteube <rsteube@users.noreply.github.com>
This commit is contained in:
aftix 2025-02-15 03:22:45 -06:00 committed by GitHub
parent 573aeea475
commit 3f5bed15b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 49 additions and 141 deletions

View File

@ -17,6 +17,7 @@ func init() {
abandonCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
abandonCmd.Flags().Bool("restore-descendants", false, "Preserve the content (not the diff) when rebasing descendants")
abandonCmd.Flags().Bool("retain-bookmarks", false, "Move bookmarks to the parent revisions instead of deleting them")
abandonCmd.Flags().BoolP("summary", "s", false, "Do not print every abandoned commit on a separate line")
rootCmd.AddCommand(abandonCmd)

View File

@ -1,32 +0,0 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/jj"
"github.com/spf13/cobra"
)
var catCmd = &cobra.Command{
Use: "cat [OPTIONS] <PATH>",
Short: "Print contents of a file in a revision",
Aliases: []string{"print"},
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(catCmd).Standalone()
catCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
catCmd.Flags().StringP("revision", "r", "", "The revision to get the file contents from")
rootCmd.AddCommand(catCmd)
carapace.Gen(catCmd).FlagCompletion(carapace.ActionMap{
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
})
carapace.Gen(catCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return jj.ActionRevFiles(catCmd.Flag("revision").Value.String())
}),
)
}

View File

@ -1,39 +0,0 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/jj"
"github.com/carapace-sh/carapace/pkg/style"
"github.com/spf13/cobra"
)
var chmodCmd = &cobra.Command{
Use: "chmod",
Short: "Sets or removes the executable bit for paths in the repo",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(chmodCmd).Standalone()
chmodCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
chmodCmd.Flags().StringP("revision", "r", "", "The revision to update")
rootCmd.AddCommand(chmodCmd)
carapace.Gen(chmodCmd).FlagCompletion(carapace.ActionMap{
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
})
carapace.Gen(chmodCmd).PositionalCompletion(
carapace.ActionStyledValuesDescribed(
"n", "normal", style.Default,
"x", "executable", style.Yellow,
),
)
carapace.Gen(chmodCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return jj.ActionRevFiles(chmodCmd.Flag("revision").Value.String())
}),
)
}

View File

@ -21,8 +21,16 @@ func init() {
commitCmd.Flags().BoolP("interactive", "i", false, "Interactively choose which changes to include in the first commit")
commitCmd.Flags().StringSliceP("message", "m", []string{}, "The change description to use (don't open editor)")
commitCmd.Flags().Bool("reset-author", false, "Reset the author to the configured user")
commitCmd.Flags().String("tool", "", "Specify diff editor to be used (implies --interactive)")
rootCmd.AddCommand(commitCmd)
carapace.Gen(commitCmd).FlagCompletion(carapace.ActionMap{
"tool": carapace.Batch(
carapace.ActionExecutables(),
carapace.ActionFiles(),
).ToA(),
})
carapace.Gen(commitCmd).PositionalAnyCompletion(
jj.ActionRevDiffs().FilterArgs(),
)

View File

@ -17,11 +17,14 @@ func init() {
carapace.Gen(describeCmd).Standalone()
describeCmd.Flags().String("author", "", "Set author to the provided string")
describeCmd.Flags().Bool("edit", true, "Open an editor")
describeCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
describeCmd.Flags().StringSliceP("message", "m", []string{}, "The change description to use (don't open editor)")
describeCmd.Flags().Bool("no-edit", false, "Don't open an editor")
describeCmd.Flags().Bool("reset-author", false, "Reset the author to the configured user")
describeCmd.Flags().Bool("stdin", false, "Read the change description from stdin")
describeCmd.MarkFlagsMutuallyExclusive("edit", "no-edit")
rootCmd.AddCommand(describeCmd)
carapace.Gen(describeCmd).PositionalCompletion(

View File

@ -21,9 +21,9 @@ func init() {
evologCmd.Flags().Bool("git", false, "Show a Git-format diff")
evologCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
evologCmd.Flags().StringP("limit", "n", "", "Limit number of revisions to show")
evologCmd.Flags().StringS("limit-old-shorthand", "l", "", "Limit number of revisions to show")
evologCmd.Flags().Bool("no-graph", false, "Don't show the graph, show a flat list of revisions")
evologCmd.Flags().BoolP("patch", "p", false, "Show patch compared to the previous version of this change")
evologCmd.Flags().Bool("reversed", false, "Show revisions in the opposite order (older revisions first)")
evologCmd.Flags().StringP("revision", "r", "", "")
evologCmd.Flags().Bool("stat", false, "Show a histogram of the changes")
evologCmd.Flags().BoolP("summary", "s", false, "For each path, show only whether it was modified, added, or removed")
@ -32,8 +32,6 @@ func init() {
evologCmd.Flags().Bool("types", false, "For each path, show only its type before and after")
rootCmd.AddCommand(evologCmd)
evologCmd.MarkFlagsMutuallyExclusive("limit", "limit-old-shorthand")
carapace.Gen(evologCmd).FlagCompletion(carapace.ActionMap{
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
"tool": bridge.ActionCarapaceBin().Split(),

View File

@ -1,31 +0,0 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/jj"
"github.com/spf13/cobra"
)
var filesCmd = &cobra.Command{
Use: "files [OPTIONS] [PATHS]...",
Short: "List files in a revision",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(filesCmd).Standalone()
filesCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
filesCmd.Flags().StringP("revision", "r", "@", "The revision to list files in")
rootCmd.AddCommand(filesCmd)
carapace.Gen(filesCmd).FlagCompletion(carapace.ActionMap{
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
})
carapace.Gen(filesCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return jj.ActionRevFiles(filesCmd.Flag("revision").Value.String())
}),
)
}

View File

@ -14,15 +14,9 @@ var initCmd = &cobra.Command{
func init() {
carapace.Gen(initCmd).Standalone()
initCmd.Flags().Bool("git", false, "Use the Git backend, creating a jj repo backed by a Git repo")
initCmd.Flags().String("git-repo", "", "Path to a git repo the jj repo will be backed by")
initCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
rootCmd.AddCommand(initCmd)
carapace.Gen(initCmd).FlagCompletion(carapace.ActionMap{
"git-repo": carapace.ActionDirectories(),
})
carapace.Gen(initCmd).PositionalCompletion(
carapace.ActionDirectories(),
)

View File

@ -20,7 +20,6 @@ func init() {
logCmd.Flags().Bool("git", false, "Show a Git-format diff")
logCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
logCmd.Flags().StringP("limit", "n", "", "Limit number of revisions to show")
logCmd.Flags().StringS("limit-old-shorthand", "l", "", "Limit number of revisions to show")
logCmd.Flags().Bool("no-graph", false, "Don't show the graph, show a flat list of revisions")
logCmd.Flags().BoolP("patch", "p", false, "Show patch")
logCmd.Flags().Bool("reversed", false, "Show revisions in the opposite order (older revisions first)")
@ -32,8 +31,6 @@ func init() {
logCmd.Flags().Bool("types", false, "For each path, show only its type before and after")
rootCmd.AddCommand(logCmd)
logCmd.MarkFlagsMutuallyExclusive("limit", "limit-old-shorthand")
carapace.Gen(logCmd).FlagCompletion(carapace.ActionMap{
"revisions": jj.ActionRevSets(jj.RevOption{}.Default()),
"tool": bridge.ActionCarapaceBin().Split(),

View File

@ -16,12 +16,10 @@ func init() {
operation_logCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
operation_logCmd.Flags().StringP("limit", "n", "", "Limit number of revisions to show")
operation_logCmd.Flags().StringS("limit-old-shorthand", "l", "", "Limit number of revisions to show")
operation_logCmd.Flags().Bool("no-graph", false, "Don't show the graph, show a flat list of operations")
operation_logCmd.Flags().Bool("op-diff", false, "Show changes to the repository at each operation")
operation_logCmd.Flags().BoolP("patch", "p", false, "Show patch of modifications to changes (implies --op-diff)")
operation_logCmd.Flags().Bool("reversed", false, " Show operations in the opposite order (older operations first)")
operation_logCmd.Flags().StringP("template", "T", "", "Render each operation using the given template")
operationCmd.AddCommand(operation_logCmd)
operation_logCmd.MarkFlagsMutuallyExclusive("limit", "limit-old-shorthand")
}

View File

@ -18,13 +18,24 @@ func init() {
restoreCmd.Flags().StringP("changes-in", "c", "", "Undo the changes in a revision as compared to the merge of its parents")
restoreCmd.Flags().StringP("from", "f", "@", "Revision to restore from (source)")
restoreCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
restoreCmd.Flags().BoolP("interactive", "i", false, "Interactively choose which parts to restore")
restoreCmd.Flags().StringP("into", "t", "@", "Revision to restore into (destination)")
restoreCmd.Flags().Bool("restore-descendants", false, "Preserve the content (not the diff) when rebasing descendants")
restoreCmd.Flags().StringP("to", "t", "@", "Revision to restore into (destination)")
restoreCmd.Flags().String("to", "@", "Revision to restore into (alias for --into)")
restoreCmd.Flags().String("tool", "", "Specify diff editor to be used (implies --interactive)")
restoreCmd.MarkFlagsMutuallyExclusive("into", "to")
rootCmd.AddCommand(restoreCmd)
carapace.Gen(restoreCmd).FlagCompletion(carapace.ActionMap{
"from": jj.ActionRevs(jj.RevOption{}.Default()),
"into": jj.ActionRevs(jj.RevOption{}.Default()),
"to": jj.ActionRevs(jj.RevOption{}.Default()),
"tool": carapace.Batch(
carapace.ActionExecutables(),
carapace.ActionFiles(),
).ToA(),
})
carapace.Gen(restoreCmd).PositionalAnyCompletion(

View File

@ -17,13 +17,10 @@ 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().BoolP("parallel", "p", false, "Split the revision into two siblings instead of parent and child")
splitCmd.Flags().BoolP("parallel", "p", false, "Split the revision into two parallel instead of parent and child")
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") // deprecated in v0.19.0
rootCmd.AddCommand(splitCmd)
splitCmd.MarkFlagsMutuallyExclusive("parallel", "siblings")
carapace.Gen(splitCmd).FlagCompletion(carapace.ActionMap{
"revision": jj.ActionRevs(jj.RevOption{}.Default()),
})

View File

@ -0,0 +1,22 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var util_installmanpagesCmd = &cobra.Command{
Use: "install-man-pages",
Short: "Install Jujutsu's manpages to the provided path",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(util_installmanpagesCmd).Standalone()
util_installmanpagesCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
carapace.Gen(util_installmanpagesCmd).PositionalCompletion(carapace.ActionFiles())
utilCmd.AddCommand(util_installmanpagesCmd)
}

View File

@ -1,19 +0,0 @@
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var util_mangenCmd = &cobra.Command{
Use: "mangen",
Short: "Print a ROFF (manpage)",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(util_mangenCmd).Standalone()
util_mangenCmd.Flags().BoolP("help", "h", false, "Print help (see more with '--help')")
utilCmd.AddCommand(util_mangenCmd)
}