Skip to content

Commit

Permalink
cli: file: sort subcommands chronologically
Browse files Browse the repository at this point in the history
Otherwise they wouldn't be sorted in help. I also reordered the match statement.
Since subcommands are split to per-file modules, there's no point to keep some
logical ordering.
  • Loading branch information
yuja committed Jun 18, 2024
1 parent a861bae commit 4ab1fc9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions cli/src/commands/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use crate::ui::Ui;
/// File operations.
#[derive(clap::Subcommand, Clone, Debug)]
pub enum FileCommand {
Print(print::PrintArgs),
Chmod(chmod::ChmodArgs),
List(list::ListArgs),
Print(print::PrintArgs),
}

pub fn cmd_file(
Expand All @@ -34,8 +34,8 @@ pub fn cmd_file(
subcommand: &FileCommand,
) -> Result<(), CommandError> {
match subcommand {
FileCommand::Print(sub_args) => print::cmd_print(ui, command, sub_args),
FileCommand::Chmod(sub_args) => chmod::cmd_chmod(ui, command, sub_args),
FileCommand::List(sub_args) => list::cmd_list(ui, command, sub_args),
FileCommand::Print(sub_args) => print::cmd_print(ui, command, sub_args),
}
}
44 changes: 22 additions & 22 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ This document contains the help content for the `jj` command-line program.
* [`jj duplicate`↴](#jj-duplicate)
* [`jj edit`↴](#jj-edit)
* [`jj file`↴](#jj-file)
* [`jj file print`↴](#jj-file-print)
* [`jj file chmod`↴](#jj-file-chmod)
* [`jj file list`↴](#jj-file-list)
* [`jj file print`↴](#jj-file-print)
* [`jj fix`↴](#jj-fix)
* [`jj git`↴](#jj-git)
* [`jj git remote`↴](#jj-git-remote)
Expand Down Expand Up @@ -652,29 +652,9 @@ File operations
###### **Subcommands:**
* `print` — Print contents of files in a revision
* `chmod` — Sets or removes the executable bit for paths in the repo
* `list` — List files in a revision
## `jj file print`
Print contents of files in a revision
If the given path is a directory, files in the directory will be visited recursively.
**Usage:** `jj file print [OPTIONS] <PATHS>...`
###### **Arguments:**
* `<PATHS>` — Paths to print
###### **Options:**
* `-r`, `--revision <REVISION>` — The revision to get the file contents from
Default value: `@`
* `print` — Print contents of files in a revision
Expand Down Expand Up @@ -724,6 +704,26 @@ List files in a revision
## `jj file print`
Print contents of files in a revision
If the given path is a directory, files in the directory will be visited recursively.
**Usage:** `jj file print [OPTIONS] <PATHS>...`
###### **Arguments:**
* `<PATHS>` — Paths to print
###### **Options:**
* `-r`, `--revision <REVISION>` — The revision to get the file contents from
Default value: `@`
## `jj fix`
Update files with formatting fixes or other changes
Expand Down

0 comments on commit 4ab1fc9

Please sign in to comment.