From adcd78a0b79d280de5486e2d618ecc7a1d34ce5d Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 20 Jun 2024 16:54:28 +0900 Subject: [PATCH] cli: sort config/sparse subcommands in lexicographical order --- cli/src/commands/config.rs | 18 ++--- cli/src/commands/sparse.rs | 8 +-- cli/tests/cli-reference@.md.snap | 114 +++++++++++++++---------------- 3 files changed, 70 insertions(+), 70 deletions(-) diff --git a/cli/src/commands/config.rs b/cli/src/commands/config.rs index d5b972c90c..4c33a0021d 100644 --- a/cli/src/commands/config.rs +++ b/cli/src/commands/config.rs @@ -63,16 +63,16 @@ impl ConfigLevelArgs { /// config, see https://github.com/martinvonz/jj/blob/main/docs/config.md. #[derive(clap::Subcommand, Clone, Debug)] pub(crate) enum ConfigCommand { - #[command(visible_alias("l"))] - List(ConfigListArgs), - #[command(visible_alias("g"))] - Get(ConfigGetArgs), - #[command(visible_alias("s"))] - Set(ConfigSetArgs), #[command(visible_alias("e"))] Edit(ConfigEditArgs), + #[command(visible_alias("g"))] + Get(ConfigGetArgs), + #[command(visible_alias("l"))] + List(ConfigListArgs), #[command(visible_alias("p"))] Path(ConfigPathArgs), + #[command(visible_alias("s"))] + Set(ConfigSetArgs), } /// List variables set in config file, along with their values. @@ -158,11 +158,11 @@ pub(crate) fn cmd_config( subcommand: &ConfigCommand, ) -> Result<(), CommandError> { match subcommand { - ConfigCommand::List(args) => cmd_config_list(ui, command, args), - ConfigCommand::Get(args) => cmd_config_get(ui, command, args), - ConfigCommand::Set(args) => cmd_config_set(ui, command, args), ConfigCommand::Edit(args) => cmd_config_edit(ui, command, args), + ConfigCommand::Get(args) => cmd_config_get(ui, command, args), + ConfigCommand::List(args) => cmd_config_list(ui, command, args), ConfigCommand::Path(args) => cmd_config_path(ui, command, args), + ConfigCommand::Set(args) => cmd_config_set(ui, command, args), } } diff --git a/cli/src/commands/sparse.rs b/cli/src/commands/sparse.rs index f1cdf085a6..4e04f439de 100644 --- a/cli/src/commands/sparse.rs +++ b/cli/src/commands/sparse.rs @@ -35,10 +35,10 @@ use crate::ui::Ui; /// copy #[derive(Subcommand, Clone, Debug)] pub(crate) enum SparseCommand { + Edit(SparseEditArgs), List(SparseListArgs), - Set(SparseSetArgs), Reset(SparseResetArgs), - Edit(SparseEditArgs), + Set(SparseSetArgs), } /// List the patterns that are currently present in the working copy @@ -91,10 +91,10 @@ pub(crate) fn cmd_sparse( subcommand: &SparseCommand, ) -> Result<(), CommandError> { match subcommand { + SparseCommand::Edit(args) => cmd_sparse_edit(ui, command, args), SparseCommand::List(args) => cmd_sparse_list(ui, command, args), - SparseCommand::Set(args) => cmd_sparse_set(ui, command, args), SparseCommand::Reset(args) => cmd_sparse_reset(ui, command, args), - SparseCommand::Edit(args) => cmd_sparse_edit(ui, command, args), + SparseCommand::Set(args) => cmd_sparse_set(ui, command, args), } } diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index ee125c015c..e139db4d37 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -25,11 +25,11 @@ This document contains the help content for the `jj` command-line program. * [`jj branch untrack`↴](#jj-branch-untrack) * [`jj commit`↴](#jj-commit) * [`jj config`↴](#jj-config) -* [`jj config list`↴](#jj-config-list) -* [`jj config get`↴](#jj-config-get) -* [`jj config set`↴](#jj-config-set) * [`jj config edit`↴](#jj-config-edit) +* [`jj config get`↴](#jj-config-get) +* [`jj config list`↴](#jj-config-list) * [`jj config path`↴](#jj-config-path) +* [`jj config set`↴](#jj-config-set) * [`jj describe`↴](#jj-describe) * [`jj diff`↴](#jj-diff) * [`jj diffedit`↴](#jj-diffedit) @@ -71,10 +71,10 @@ This document contains the help content for the `jj` command-line program. * [`jj root`↴](#jj-root) * [`jj show`↴](#jj-show) * [`jj sparse`↴](#jj-sparse) +* [`jj sparse edit`↴](#jj-sparse-edit) * [`jj sparse list`↴](#jj-sparse-list) -* [`jj sparse set`↴](#jj-sparse-set) * [`jj sparse reset`↴](#jj-sparse-reset) -* [`jj sparse edit`↴](#jj-sparse-edit) +* [`jj sparse set`↴](#jj-sparse-set) * [`jj split`↴](#jj-split) * [`jj squash`↴](#jj-squash) * [`jj status`↴](#jj-status) @@ -451,39 +451,26 @@ For file locations, supported config options, and other details about jj config, ###### **Subcommands:** -* `list` — List variables set in config file, along with their values -* `get` — Get the value of a given config option. -* `set` — Update config file to set the given option to a given value * `edit` — Start an editor on a jj config file +* `get` — Get the value of a given config option. +* `list` — List variables set in config file, along with their values * `path` — Print the path to the config file +* `set` — Update config file to set the given option to a given value -## `jj config list` - -List variables set in config file, along with their values +## `jj config edit` -**Usage:** `jj config list [OPTIONS] [NAME]` +Start an editor on a jj config file. -###### **Arguments:** +Creates the file if it doesn't already exist regardless of what the editor does. -* `` — An optional name of a specific config option to look up +**Usage:** `jj config edit <--user|--repo>` ###### **Options:** -* `--include-defaults` — Whether to explicitly include built-in default values in the list -* `--include-overridden` — Allow printing overridden values * `--user` — Target the user-level config * `--repo` — Target the repo-level config -* `-T`, `--template