Skip to content

Commit

Permalink
cli: sort config/sparse subcommands in lexicographical order
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Jun 21, 2024
1 parent 78dba90 commit adcd78a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 70 deletions.
18 changes: 9 additions & 9 deletions cli/src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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),
}
}

Expand Down
8 changes: 4 additions & 4 deletions cli/src/commands/sparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
}
}

Expand Down
114 changes: 57 additions & 57 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
* `<NAME>` — 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 <TEMPLATE>` — Render each variable using the given template
The following keywords are defined:
* `name: String`: Config name.
* `value: String`: Serialized value in TOML syntax.
* `overridden: Boolean`: True if the value is shadowed by other.
For the syntax, see https://github.com/martinvonz/jj/blob/main/docs/templates.md
Expand All @@ -507,31 +494,43 @@ Martin von Zweigbergk
## `jj config set`
## `jj config list`
Update config file to set the given option to a given value
List variables set in config file, along with their values
**Usage:** `jj config set <--user|--repo> <NAME> <VALUE>`
**Usage:** `jj config list [OPTIONS] [NAME]`
###### **Arguments:**
* `<NAME>`
* `<VALUE>`
* `<NAME>` — An optional name of a specific config option to look up
###### **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 <TEMPLATE>` — Render each variable using the given template
The following keywords are defined:
* `name: String`: Config name.
* `value: String`: Serialized value in TOML syntax.
* `overridden: Boolean`: True if the value is shadowed by other.
## `jj config edit`
For the syntax, see https://github.com/martinvonz/jj/blob/main/docs/templates.md
Start an editor on a jj config file.
Creates the file if it doesn't already exist regardless of what the editor does.
**Usage:** `jj config edit <--user|--repo>`
## `jj config path`
Print the path to the config file
A config file at that path may or may not exist.
See `jj config edit` if you'd like to immediately edit the file.
**Usage:** `jj config path <--user|--repo>`
###### **Options:**
Expand All @@ -540,15 +539,16 @@ Creates the file if it doesn't already exist regardless of what the editor does.
## `jj config path`
## `jj config set`
Print the path to the config file
Update config file to set the given option to a given value
A config file at that path may or may not exist.
**Usage:** `jj config set <--user|--repo> <NAME> <VALUE>`
See `jj config edit` if you'd like to immediately edit the file.
###### **Arguments:**
**Usage:** `jj config path <--user|--repo>`
* `<NAME>`
* `<VALUE>`
###### **Options:**
Expand Down Expand Up @@ -1624,10 +1624,18 @@ Manage which paths from the working-copy commit are present in the working copy
###### **Subcommands:**
* `edit` — Start an editor to update the patterns that are present in the working copy
* `list` — List the patterns that are currently present in the working copy
* `set` — Update the patterns that are present in the working copy
* `reset` — Reset the patterns to include all files in the working copy
* `edit` — Start an editor to update the patterns that are present in the working copy
* `set` — Update the patterns that are present in the working copy
## `jj sparse edit`
Start an editor to update the patterns that are present in the working copy
**Usage:** `jj sparse edit`
Expand All @@ -1641,6 +1649,14 @@ By default, a newly cloned or initialized repo will have have a pattern matching
## `jj sparse reset`
Reset the patterns to include all files in the working copy
**Usage:** `jj sparse reset`
## `jj sparse set`
Update the patterns that are present in the working copy
Expand All @@ -1657,22 +1673,6 @@ For example, if all you need is the `README.md` and the `lib/` directory, use `j
## `jj sparse reset`
Reset the patterns to include all files in the working copy
**Usage:** `jj sparse reset`
## `jj sparse edit`
Start an editor to update the patterns that are present in the working copy
**Usage:** `jj sparse edit`
## `jj split`
Split a revision in two
Expand Down

0 comments on commit adcd78a

Please sign in to comment.