Skip to content

Commit

Permalink
cli: refer to fileset argument using FILESETS in synopsis
Browse files Browse the repository at this point in the history
This should help clarify that the arguments are not just simple paths
(assuming `ui.allow-filesets` is not disabled).
  • Loading branch information
martinvonz committed Dec 18, 2024
1 parent 6bbaf79 commit bf0faca
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 46 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/absorb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub(crate) struct AbsorbArgs {
)]
into: Vec<RevisionArg>,
/// Move only changes to these paths (instead of all paths)
#[arg(value_hint = clap::ValueHint::AnyPath)]
#[arg(value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub(crate) struct CommitArgs {
message_paragraphs: Vec<String>,
/// Put these paths in the first commit
#[arg(
value_name = "FILESETS",
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::modified_files),
)]
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/debug/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct DebugTreeArgs {
id: Option<String>,
#[arg(long, requires = "id")]
dir: Option<String>,
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
// TODO: Add an option to include trees that are ancestors of the matched paths
}
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub(crate) struct DiffArgs {
to: Option<RevisionArg>,
/// Restrict the diff to these paths
#[arg(
value_name = "FILESETS",
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::modified_revision_or_range_files),
)]
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/file/chmod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub(crate) struct FileChmodArgs {
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::all_revision_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/file/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) struct FileListArgs {
)]
revision: RevisionArg,
/// Only list files matching these prefixes (instead of all files)
#[arg(value_hint = clap::ValueHint::AnyPath)]
#[arg(value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/file/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub(crate) struct FileShowArgs {
value_hint = clap::ValueHint::FilePath,
add = ArgValueCompleter::new(complete::all_revision_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/file/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct FileTrackArgs {
/// Paths to track
#[arg(required = true, value_hint = clap::ValueHint::AnyPath)]
#[arg(required = true, value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/file/untrack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub(crate) struct FileUntrackArgs {
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::all_revision_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub(crate) struct FixArgs {
#[arg(long, short, add = ArgValueCandidates::new(complete::mutable_revisions))]
source: Vec<RevisionArg>,
/// Fix only these paths
#[arg(value_hint = clap::ValueHint::AnyPath)]
#[arg(value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,
/// Fix unchanged files in addition to changed ones. If no paths are
/// specified, all files in the repo will be fixed.
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/interdiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub(crate) struct InterdiffArgs {
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::interdiff_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
#[command(flatten)]
format: DiffFormatArgs,
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub(crate) struct LogArgs {
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::log_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
/// Show revisions in the opposite order (older revisions first)
#[arg(long)]
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub(crate) struct ResolveArgs {
/// the `--list` argument to find paths to use here.
// TODO: Find the conflict we can resolve even if it's not the first one.
#[arg(
value_name = "FILESETS",
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::revision_conflicted_files),
)]
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub(crate) struct RestoreArgs {
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::modified_range_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
/// Revision to restore from (source)
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
Expand Down
7 changes: 4 additions & 3 deletions cli/src/commands/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ pub(crate) struct SplitArgs {
parallel: bool,
/// Files matching any of these filesets are put in the first commit
#[arg(
value_name = "FILESETS",
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::modified_revision_files),
)]
filesets: Vec<String>,
paths: Vec<String>,
}

#[instrument(skip_all)]
Expand All @@ -92,12 +93,12 @@ pub(crate) fn cmd_split(

workspace_command.check_rewritable([commit.id()])?;
let matcher = workspace_command
.parse_file_patterns(ui, &args.filesets)?
.parse_file_patterns(ui, &args.paths)?
.to_matcher();
let diff_selector = workspace_command.diff_selector(
ui,
args.tool.as_deref(),
args.interactive || args.filesets.is_empty(),
args.interactive || args.paths.is_empty(),
)?;
let mut tx = workspace_command.start_transaction();
let end_tree = commit.tree()?;
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/squash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub(crate) struct SquashArgs {
value_hint = clap::ValueHint::AnyPath,
add = ArgValueCompleter::new(complete::squash_revision_files),
)]
#[arg(value_name = "FILESETS")]
paths: Vec<String>,
/// The source revision will not be abandoned
#[arg(long, short)]
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use crate::ui::Ui;
#[command(visible_alias = "st")]
pub(crate) struct StatusArgs {
/// Restrict the status display to these paths
#[arg(value_hint = clap::ValueHint::AnyPath)]
#[arg(value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
paths: Vec<String>,
}

Expand Down
60 changes: 30 additions & 30 deletions cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ This command splits changes in the source revision and moves each change to the
The modification made by `jj absorb` can be reviewed by `jj op show -p`.
**Usage:** `jj absorb [OPTIONS] [PATHS]...`
**Usage:** `jj absorb [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Move only changes to these paths (instead of all paths)
* `<FILESETS>` — Move only changes to these paths (instead of all paths)
###### **Options:**
Expand Down Expand Up @@ -475,11 +475,11 @@ A non-tracking remote bookmark is just a pointer to the last-fetched remote book
Update the description and create a new change on top
**Usage:** `jj commit [OPTIONS] [PATHS]...`
**Usage:** `jj commit [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Put these paths in the first commit
* `<FILESETS>` — Put these paths in the first commit
###### **Options:**
Expand Down Expand Up @@ -683,11 +683,11 @@ With the `-r` option, which is the default, shows the changes compared to the pa
With the `--from` and/or `--to` options, shows the difference from/to the given revisions. If either is left out, it defaults to the working-copy commit. For example, `jj diff --from main` shows the changes from "main" (perhaps a bookmark name) to the working-copy commit.
**Usage:** `jj diff [OPTIONS] [PATHS]...`
**Usage:** `jj diff [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Restrict the diff to these paths
* `<FILESETS>` — Restrict the diff to these paths
###### **Options:**
Expand Down Expand Up @@ -864,7 +864,7 @@ Sets or removes the executable bit for paths in the repo
Unlike the POSIX `chmod`, `jj file chmod` also works on Windows, on conflicted files, and on arbitrary revisions.
**Usage:** `jj file chmod [OPTIONS] <MODE> <PATHS>...`
**Usage:** `jj file chmod [OPTIONS] <MODE> <FILESETS>...`
###### **Arguments:**
Expand All @@ -876,7 +876,7 @@ Unlike the POSIX `chmod`, `jj file chmod` also works on Windows, on conflicted f
- `x`:
Make a path executable (alias: executable)
* `<PATHS>` — Paths to change the executable bit for
* `<FILESETS>` — Paths to change the executable bit for
###### **Options:**
Expand All @@ -890,11 +890,11 @@ Unlike the POSIX `chmod`, `jj file chmod` also works on Windows, on conflicted f
List files in a revision
**Usage:** `jj file list [OPTIONS] [PATHS]...`
**Usage:** `jj file list [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Only list files matching these prefixes (instead of all files)
* `<FILESETS>` — Only list files matching these prefixes (instead of all files)
###### **Options:**
Expand All @@ -910,11 +910,11 @@ 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 show [OPTIONS] <PATHS>...`
**Usage:** `jj file show [OPTIONS] <FILESETS>...`
###### **Arguments:**
* `<PATHS>` — Paths to print
* `<FILESETS>` — Paths to print
###### **Options:**
Expand All @@ -932,23 +932,23 @@ Without arguments, all paths that are not ignored will be tracked.
New files in the working copy can be automatically tracked. You can configure which paths to automatically track by setting `snapshot.auto-track` (e.g. to `"none()"` or `"glob:**/*.rs"`). Files that don't match the pattern can be manually tracked using this command. The default pattern is `all()` and this command has no effect.
**Usage:** `jj file track <PATHS>...`
**Usage:** `jj file track <FILESETS>...`
###### **Arguments:**
* `<PATHS>` — Paths to track
* `<FILESETS>` — Paths to track
## `jj file untrack`
Stop tracking specified paths in the working copy
**Usage:** `jj file untrack <PATHS>...`
**Usage:** `jj file untrack <FILESETS>...`
###### **Arguments:**
* `<PATHS>` — Paths to untrack. They must already be ignored.
* `<FILESETS>` — Paths to untrack. They must already be ignored.
The paths could be ignored via a .gitignore or .git/info/exclude (in colocated repos).
Expand Down Expand Up @@ -1022,11 +1022,11 @@ The tool defined by `tool-command` acts as if it was the first entry in
`fix.tools`, and uses `pattern = "all()"``. Support for `tool-command`
will be removed in a future version.
**Usage:** `jj fix [OPTIONS] [PATHS]...`
**Usage:** `jj fix [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Fix only these paths
* `<FILESETS>` — Fix only these paths
###### **Options:**
Expand Down Expand Up @@ -1321,11 +1321,11 @@ Compare the changes of two commits
This excludes changes from other commits by temporarily rebasing `--from` onto `--to`'s parents. If you wish to compare the same change across versions, consider `jj evolog -p` instead.
**Usage:** `jj interdiff [OPTIONS] <--from <FROM>|--to <TO>> [PATHS]...`
**Usage:** `jj interdiff [OPTIONS] <--from <FROM>|--to <TO>> [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Restrict the diff to these paths
* `<FILESETS>` — Restrict the diff to these paths
###### **Options:**
Expand Down Expand Up @@ -1358,11 +1358,11 @@ Spans of revisions that are not included in the graph per `--revisions` are rend
The working-copy commit is indicated by a `@` symbol in the graph. Immutable revisions (https://jj-vcs.github.io/jj/latest/config/#set-of-immutable-commits) have a `◆` symbol. Other commits have a `○` symbol. To customize these symbols, see https://jj-vcs.github.io/jj/latest/config/#node-style.
**Usage:** `jj log [OPTIONS] [PATHS]...`
**Usage:** `jj log [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Show revisions modifying the given paths
* `<FILESETS>` — Show revisions modifying the given paths
###### **Options:**
Expand Down Expand Up @@ -1890,11 +1890,11 @@ Only conflicts that can be resolved with a 3-way merge are supported. See docs f
Note that conflicts can also be resolved without using this command. You may edit the conflict markers in the conflicted file directly with a text editor.
**Usage:** `jj resolve [OPTIONS] [PATHS]...`
**Usage:** `jj resolve [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Restrict to these paths when searching for a conflict to resolve. We will attempt to resolve the first conflict we can find. You can use the `--list` argument to find paths to use here
* `<FILESETS>` — Restrict to these paths when searching for a conflict to resolve. We will attempt to resolve the first conflict we can find. You can use the `--list` argument to find paths to use here
###### **Options:**
Expand All @@ -1918,11 +1918,11 @@ When neither `--from` nor `--to` is specified, the command restores into the wor
See `jj diffedit` if you'd like to restore portions of files rather than entire files.
**Usage:** `jj restore [OPTIONS] [PATHS]...`
**Usage:** `jj restore [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Restore only these paths (instead of all paths)
* `<FILESETS>` — Restore only these paths (instead of all paths)
###### **Options:**
Expand Down Expand Up @@ -2100,11 +2100,11 @@ If the source was abandoned and both the source and destination had a non-empty
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
**Usage:** `jj squash [OPTIONS] [PATHS]...`
**Usage:** `jj squash [OPTIONS] [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Move only changes to these paths (instead of all paths)
* `<FILESETS>` — Move only changes to these paths (instead of all paths)
###### **Options:**
Expand All @@ -2127,11 +2127,11 @@ This includes:
* The working copy commit and its (first) parent, and a summary of the changes between them * Conflicted bookmarks (see https://jj-vcs.github.io/jj/latest/bookmarks/)
**Usage:** `jj status [PATHS]...`
**Usage:** `jj status [FILESETS]...`
###### **Arguments:**
* `<PATHS>` — Restrict the status display to these paths
* `<FILESETS>` — Restrict the status display to these paths
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn test_alias_calls_command_with_invalid_option() {
tip: to pass '--nonexistent' as a value, use '-- --nonexistent'
Usage: jj log [OPTIONS] [PATHS]...
Usage: jj log [OPTIONS] [FILESETS]...
For more information, try '--help'.
"###);
Expand Down
Loading

0 comments on commit bf0faca

Please sign in to comment.