mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-24 12:48:55 +00:00
cli: upgrade to clap 3.0 now that it's released
This commit is contained in:
parent
9ec0e4c1bb
commit
504148a81f
3 changed files with 228 additions and 196 deletions
87
Cargo.lock
generated
87
Cargo.lock
generated
|
@ -11,15 +11,6 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi_term"
|
|
||||||
version = "0.12.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
@ -171,13 +162,34 @@ version = "2.34.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
|
||||||
"atty",
|
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"strsim",
|
|
||||||
"textwrap 0.11.0",
|
"textwrap 0.11.0",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"vec_map",
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "3.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d01c9347757e131122b19cd19a05c85805b68c2352a97b623efdc3c295290299"
|
||||||
|
dependencies = [
|
||||||
|
"atty",
|
||||||
|
"bitflags",
|
||||||
|
"indexmap",
|
||||||
|
"lazy_static",
|
||||||
|
"os_str_bytes",
|
||||||
|
"strsim",
|
||||||
|
"termcolor",
|
||||||
|
"textwrap 0.14.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_complete"
|
||||||
|
version = "3.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a394f7ec0715b42a4e52b294984c27c9a61f77c8d82f7774c5198350be143f19"
|
||||||
|
dependencies = [
|
||||||
|
"clap 3.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -204,7 +216,7 @@ checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"cast",
|
"cast",
|
||||||
"clap",
|
"clap 2.34.0",
|
||||||
"criterion-plot",
|
"criterion-plot",
|
||||||
"csv",
|
"csv",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
@ -419,6 +431,12 @@ version = "1.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.11.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.18"
|
version = "0.1.18"
|
||||||
|
@ -445,6 +463,16 @@ dependencies = [
|
||||||
"unicode-normalization",
|
"unicode-normalization",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "1.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indoc"
|
name = "indoc"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
|
@ -503,7 +531,8 @@ dependencies = [
|
||||||
"blake2",
|
"blake2",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap 3.0.4",
|
||||||
|
"clap_complete",
|
||||||
"config",
|
"config",
|
||||||
"criterion",
|
"criterion",
|
||||||
"dirs",
|
"dirs",
|
||||||
|
@ -752,6 +781,15 @@ dependencies = [
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_str_bytes"
|
||||||
|
version = "6.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
|
@ -1139,9 +1177,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.8.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
|
@ -1174,6 +1212,15 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "termcolor"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "test-case"
|
name = "test-case"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
|
@ -1356,12 +1403,6 @@ version = "0.2.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vec_map"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
|
|
|
@ -23,7 +23,8 @@ members = ["lib"]
|
||||||
blake2 = "0.9.2"
|
blake2 = "0.9.2"
|
||||||
bytes = "1.1.0"
|
bytes = "1.1.0"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
clap = "2.34.0"
|
clap = { version = "3.0.4", features = ["cargo"] }
|
||||||
|
clap_complete = "3.0.2"
|
||||||
config = "0.11.0"
|
config = "0.11.0"
|
||||||
criterion = "0.3.5"
|
criterion = "0.3.5"
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
|
|
334
src/commands.rs
334
src/commands.rs
|
@ -29,7 +29,7 @@ use std::sync::Arc;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
|
|
||||||
use clap::{crate_version, App, Arg, ArgMatches, SubCommand};
|
use clap::{crate_version, App, Arg, ArgMatches};
|
||||||
use criterion::Criterion;
|
use criterion::Criterion;
|
||||||
use git2::{Oid, Repository};
|
use git2::{Oid, Repository};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
@ -157,13 +157,13 @@ impl From<FilePathParseError> for CommandError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CommandHelper<'args> {
|
struct CommandHelper {
|
||||||
string_args: Vec<String>,
|
string_args: Vec<String>,
|
||||||
root_args: ArgMatches<'args>,
|
root_args: ArgMatches,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'args> CommandHelper<'args> {
|
impl CommandHelper {
|
||||||
fn new(string_args: Vec<String>, root_args: ArgMatches<'args>) -> Self {
|
fn new(string_args: Vec<String>, root_args: ArgMatches) -> Self {
|
||||||
Self {
|
Self {
|
||||||
string_args,
|
string_args,
|
||||||
root_args,
|
root_args,
|
||||||
|
@ -558,30 +558,30 @@ impl WorkspaceCommandHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rev_arg<'a, 'b>() -> Arg<'a, 'b> {
|
fn rev_arg<'help>() -> Arg<'help> {
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.long("revision")
|
.long("revision")
|
||||||
.short("r")
|
.short('r')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn paths_arg<'a, 'b>() -> Arg<'a, 'b> {
|
fn paths_arg<'help>() -> Arg<'help> {
|
||||||
Arg::with_name("paths").index(1).multiple(true)
|
Arg::new("paths").index(1).multiple_occurrences(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn message_arg<'a, 'b>() -> Arg<'a, 'b> {
|
fn message_arg<'help>() -> Arg<'help> {
|
||||||
Arg::with_name("message")
|
Arg::new("message")
|
||||||
.long("message")
|
.long("message")
|
||||||
.short("m")
|
.short('m')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_arg<'a, 'b>() -> Arg<'a, 'b> {
|
fn op_arg<'help>() -> Arg<'help> {
|
||||||
Arg::with_name("operation")
|
Arg::new("operation")
|
||||||
.long("operation")
|
.long("operation")
|
||||||
.alias("op")
|
.alias("op")
|
||||||
.short("o")
|
.short('o')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
}
|
}
|
||||||
|
@ -717,31 +717,31 @@ fn rebase_descendants(settings: &UserSettings, mut_repo: &mut MutableRepo) -> i3
|
||||||
num_rebased
|
num_rebased
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_app<'a, 'b>() -> App<'a, 'b> {
|
fn get_app<'help>() -> App<'help> {
|
||||||
let init_command = SubCommand::with_name("init")
|
let init_command = App::new("init")
|
||||||
.about("Create a new repo in the given directory")
|
.about("Create a new repo in the given directory")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Create a new repo in the given directory. If the given directory does not exist, it \
|
"Create a new repo in the given directory. If the given directory does not exist, it \
|
||||||
will be created. If no directory is given, the current directory is used.",
|
will be created. If no directory is given, the current directory is used.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("destination")
|
Arg::new("destination")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value(".")
|
.default_value(".")
|
||||||
.help("The destination directory"),
|
.help("The destination directory"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("git")
|
Arg::new("git")
|
||||||
.long("git")
|
.long("git")
|
||||||
.help("Use the Git backend, creating a jj repo backed by a Git repo"),
|
.help("Use the Git backend, creating a jj repo backed by a Git repo"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("git-store")
|
Arg::new("git-store")
|
||||||
.long("git-store")
|
.long("git-store")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Path to a .git/ directory the jj repo will be backed by"),
|
.help("Path to a .git/ directory the jj repo will be backed by"),
|
||||||
);
|
);
|
||||||
let checkout_command = SubCommand::with_name("checkout")
|
let checkout_command = App::new("checkout")
|
||||||
.alias("co")
|
.alias("co")
|
||||||
.about("Update the working copy to another revision")
|
.about("Update the working copy to another revision")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -751,18 +751,18 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
||||||
https://github.com/martinvonz/jj/blob/main/docs/working-copy.md.",
|
https://github.com/martinvonz/jj/blob/main/docs/working-copy.md.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("The revision to update to"),
|
.help("The revision to update to"),
|
||||||
);
|
);
|
||||||
let untrack_command = SubCommand::with_name("untrack")
|
let untrack_command = App::new("untrack")
|
||||||
.about("Stop tracking specified paths in the working copy")
|
.about("Stop tracking specified paths in the working copy")
|
||||||
.arg(paths_arg());
|
.arg(paths_arg());
|
||||||
let files_command = SubCommand::with_name("files")
|
let files_command = App::new("files")
|
||||||
.about("List files in a revision")
|
.about("List files in a revision")
|
||||||
.arg(rev_arg().help("The revision to list files in"));
|
.arg(rev_arg().help("The revision to list files in"));
|
||||||
let diff_command = SubCommand::with_name("diff")
|
let diff_command = App::new("diff")
|
||||||
.about("Show changes in a revision")
|
.about("Show changes in a revision")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Show changes in a revision.
|
"Show changes in a revision.
|
||||||
|
@ -777,73 +777,73 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
checkout.",
|
checkout.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("summary")
|
Arg::new("summary")
|
||||||
.long("summary")
|
.long("summary")
|
||||||
.short("s")
|
.short('s')
|
||||||
.help("For each path, show only whether it was modified, added, or removed"),
|
.help("For each path, show only whether it was modified, added, or removed"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("git")
|
Arg::new("git")
|
||||||
.long("git")
|
.long("git")
|
||||||
.conflicts_with("summary")
|
.conflicts_with("summary")
|
||||||
.help("Show a Git-format diff"),
|
.help("Show a Git-format diff"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("color-words")
|
Arg::new("color-words")
|
||||||
.long("color-words")
|
.long("color-words")
|
||||||
.conflicts_with("summary")
|
.conflicts_with("summary")
|
||||||
.conflicts_with("git")
|
.conflicts_with("git")
|
||||||
.help("Show a word-level diff with changes indicated only by color"),
|
.help("Show a word-level diff with changes indicated only by color"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.long("revision")
|
.long("revision")
|
||||||
.short("r")
|
.short('r')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Show changes changes in this revision, compared to its parent(s)"),
|
.help("Show changes changes in this revision, compared to its parent(s)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("from")
|
Arg::new("from")
|
||||||
.long("from")
|
.long("from")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Show changes from this revision"),
|
.help("Show changes from this revision"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("to")
|
Arg::new("to")
|
||||||
.long("to")
|
.long("to")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Show changes to this revision"),
|
.help("Show changes to this revision"),
|
||||||
)
|
)
|
||||||
.arg(paths_arg());
|
.arg(paths_arg());
|
||||||
let show_command = SubCommand::with_name("show")
|
let show_command = App::new("show")
|
||||||
.about("Show commit description and changes in a revision")
|
.about("Show commit description and changes in a revision")
|
||||||
.long_about("Show commit description and changes in a revision")
|
.long_about("Show commit description and changes in a revision")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("summary")
|
Arg::new("summary")
|
||||||
.long("summary")
|
.long("summary")
|
||||||
.short("s")
|
.short('s')
|
||||||
.help("For each path, show only whether it was modified, added, or removed"),
|
.help("For each path, show only whether it was modified, added, or removed"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("git")
|
Arg::new("git")
|
||||||
.long("git")
|
.long("git")
|
||||||
.conflicts_with("summary")
|
.conflicts_with("summary")
|
||||||
.help("Show a Git-format diff"),
|
.help("Show a Git-format diff"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("color-words")
|
Arg::new("color-words")
|
||||||
.long("color-words")
|
.long("color-words")
|
||||||
.conflicts_with("summary")
|
.conflicts_with("summary")
|
||||||
.conflicts_with("git")
|
.conflicts_with("git")
|
||||||
.help("Show a word-level diff with changes indicated only by color"),
|
.help("Show a word-level diff with changes indicated only by color"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("Show changes changes in this revision, compared to its parent(s)"),
|
.help("Show changes changes in this revision, compared to its parent(s)"),
|
||||||
);
|
);
|
||||||
let status_command = SubCommand::with_name("status")
|
let status_command = App::new("status")
|
||||||
.alias("st")
|
.alias("st")
|
||||||
.about("Show high-level repo status")
|
.about("Show high-level repo status")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -855,12 +855,12 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
* Conflicted branches (see https://github.com/martinvonz/jj/blob/main/docs/branches.md)\
|
* Conflicted branches (see https://github.com/martinvonz/jj/blob/main/docs/branches.md)\
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
let log_command = SubCommand::with_name("log")
|
let log_command = App::new("log")
|
||||||
.about("Show commit history")
|
.about("Show commit history")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("template")
|
Arg::new("template")
|
||||||
.long("template")
|
.long("template")
|
||||||
.short("T")
|
.short('T')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help(
|
.help(
|
||||||
"Render each revision using the given template (the syntax is not yet \
|
"Render each revision using the given template (the syntax is not yet \
|
||||||
|
@ -868,26 +868,26 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revisions")
|
Arg::new("revisions")
|
||||||
.long("revisions")
|
.long("revisions")
|
||||||
.short("r")
|
.short('r')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value(":heads()")
|
.default_value(":heads()")
|
||||||
.help("Which revisions to show"),
|
.help("Which revisions to show"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("no-graph")
|
Arg::new("no-graph")
|
||||||
.long("no-graph")
|
.long("no-graph")
|
||||||
.help("Don't show the graph, show a flat list of revisions"),
|
.help("Don't show the graph, show a flat list of revisions"),
|
||||||
);
|
);
|
||||||
let obslog_command = SubCommand::with_name("obslog")
|
let obslog_command = App::new("obslog")
|
||||||
.about("Show how a change has evolved")
|
.about("Show how a change has evolved")
|
||||||
.long_about("Show how a change has evolved as it's been updated, rebased, etc.")
|
.long_about("Show how a change has evolved as it's been updated, rebased, etc.")
|
||||||
.arg(rev_arg())
|
.arg(rev_arg())
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("template")
|
Arg::new("template")
|
||||||
.long("template")
|
.long("template")
|
||||||
.short("T")
|
.short('T')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help(
|
.help(
|
||||||
"Render each revision using the given template (the syntax is not yet \
|
"Render each revision using the given template (the syntax is not yet \
|
||||||
|
@ -895,11 +895,11 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("no-graph")
|
Arg::new("no-graph")
|
||||||
.long("no-graph")
|
.long("no-graph")
|
||||||
.help("Don't show the graph, show a flat list of revisions"),
|
.help("Don't show the graph, show a flat list of revisions"),
|
||||||
);
|
);
|
||||||
let describe_command = SubCommand::with_name("describe")
|
let describe_command = App::new("describe")
|
||||||
.about("Edit the change description")
|
.about("Edit the change description")
|
||||||
.about("Edit the description of a change")
|
.about("Edit the description of a change")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -907,18 +907,18 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
$EDITOR, or `pico` if that's not defined.",
|
$EDITOR, or `pico` if that's not defined.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("The revision whose description to edit"),
|
.help("The revision whose description to edit"),
|
||||||
)
|
)
|
||||||
.arg(message_arg().help("The change description to use (don't open editor)"))
|
.arg(message_arg().help("The change description to use (don't open editor)"))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("stdin")
|
Arg::new("stdin")
|
||||||
.long("stdin")
|
.long("stdin")
|
||||||
.help("Read the change description from stdin"),
|
.help("Read the change description from stdin"),
|
||||||
);
|
);
|
||||||
let close_command = SubCommand::with_name("close")
|
let close_command = App::new("close")
|
||||||
.alias("commit")
|
.alias("commit")
|
||||||
.about("Mark a revision closed")
|
.about("Mark a revision closed")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -926,19 +926,19 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
https://github.com/martinvonz/jj/blob/main/docs/working-copy.md.",
|
https://github.com/martinvonz/jj/blob/main/docs/working-copy.md.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("The revision to close"),
|
.help("The revision to close"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("edit")
|
Arg::new("edit")
|
||||||
.long("edit")
|
.long("edit")
|
||||||
.short("e")
|
.short('e')
|
||||||
.help("Also edit the description"),
|
.help("Also edit the description"),
|
||||||
)
|
)
|
||||||
.arg(message_arg().help("The change description to use (don't open editor)"));
|
.arg(message_arg().help("The change description to use (don't open editor)"));
|
||||||
let open_command = SubCommand::with_name("open")
|
let open_command = App::new("open")
|
||||||
.about("Mark a revision open")
|
.about("Mark a revision open")
|
||||||
.alias("uncommit")
|
.alias("uncommit")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -946,20 +946,20 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
https://github.com/martinvonz/jj/blob/main/docs/working-copy.md.",
|
https://github.com/martinvonz/jj/blob/main/docs/working-copy.md.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("The revision to open"),
|
.help("The revision to open"),
|
||||||
);
|
);
|
||||||
let duplicate_command = SubCommand::with_name("duplicate")
|
let duplicate_command = App::new("duplicate")
|
||||||
.about("Create a new change with the same content as an existing one")
|
.about("Create a new change with the same content as an existing one")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("The revision to duplicate"),
|
.help("The revision to duplicate"),
|
||||||
);
|
);
|
||||||
let abandon_command = SubCommand::with_name("abandon")
|
let abandon_command = App::new("abandon")
|
||||||
.about("Abandon a revision")
|
.about("Abandon a revision")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Abandon a revision, rebasing descendants onto its parent(s). The behavior is similar \
|
"Abandon a revision, rebasing descendants onto its parent(s). The behavior is similar \
|
||||||
|
@ -967,12 +967,12 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
`jj restore` updates the existing change.",
|
`jj restore` updates the existing change.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("The revision(s) to abandon"),
|
.help("The revision(s) to abandon"),
|
||||||
);
|
);
|
||||||
let new_command = SubCommand::with_name("new")
|
let new_command = App::new("new")
|
||||||
.about("Create a new, empty change")
|
.about("Create a new, empty change")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Create a new, empty change. This may be useful if you want to make some changes \
|
"Create a new, empty change. This may be useful if you want to make some changes \
|
||||||
|
@ -981,7 +981,7 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
unsuccessful, you can `jj abandon` them and `jj co @-` the previous working copy.",
|
unsuccessful, you can `jj abandon` them and `jj co @-` the previous working copy.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.index(1)
|
.index(1)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("Parent of the new change")
|
.help("Parent of the new change")
|
||||||
|
@ -990,7 +990,7 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
change will be checked out.",
|
change will be checked out.",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
let squash_command = SubCommand::with_name("squash")
|
let squash_command = App::new("squash")
|
||||||
.alias("amend")
|
.alias("amend")
|
||||||
.about("Move changes from a revision into its parent")
|
.about("Move changes from a revision into its parent")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -1001,24 +1001,24 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
)
|
)
|
||||||
.arg(rev_arg())
|
.arg(rev_arg())
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("interactive")
|
Arg::new("interactive")
|
||||||
.long("interactive")
|
.long("interactive")
|
||||||
.short("i")
|
.short('i')
|
||||||
.help("Interactively squash part of the changes"),
|
.help("Interactively squash part of the changes"),
|
||||||
);
|
);
|
||||||
// TODO: It doesn't make much sense to run this without -i. We should make that
|
// TODO: It doesn't make much sense to run this without -i. We should make that
|
||||||
// the default. We should also abandon the parent commit if that becomes empty.
|
// the default. We should also abandon the parent commit if that becomes empty.
|
||||||
let unsquash_command = SubCommand::with_name("unsquash")
|
let unsquash_command = App::new("unsquash")
|
||||||
.alias("unamend")
|
.alias("unamend")
|
||||||
.about("Move changes from a revision's parent into the revision")
|
.about("Move changes from a revision's parent into the revision")
|
||||||
.arg(rev_arg())
|
.arg(rev_arg())
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("interactive")
|
Arg::new("interactive")
|
||||||
.long("interactive")
|
.long("interactive")
|
||||||
.short("i")
|
.short('i')
|
||||||
.help("Interactively unsquash part of the changes"),
|
.help("Interactively unsquash part of the changes"),
|
||||||
);
|
);
|
||||||
let restore_command = SubCommand::with_name("restore")
|
let restore_command = App::new("restore")
|
||||||
.about("Restore paths from another revision")
|
.about("Restore paths from another revision")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Restore paths from another revision. That means that the paths get the same content \
|
"Restore paths from another revision. That means that the paths get the same content \
|
||||||
|
@ -1033,27 +1033,27 @@ With the `--from` and/or `--to` options, shows the difference from/to the given
|
||||||
`jj restore <path>; jj squash`.",
|
`jj restore <path>; jj squash`.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("from")
|
Arg::new("from")
|
||||||
.long("from")
|
.long("from")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("@-")
|
.default_value("@-")
|
||||||
.help("Revision to restore from (source)"),
|
.help("Revision to restore from (source)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("to")
|
Arg::new("to")
|
||||||
.long("to")
|
.long("to")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.help("Revision to restore into (destination)"),
|
.help("Revision to restore into (destination)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("interactive")
|
Arg::new("interactive")
|
||||||
.long("interactive")
|
.long("interactive")
|
||||||
.short("i")
|
.short('i')
|
||||||
.help("Interactively restore part of the changes"),
|
.help("Interactively restore part of the changes"),
|
||||||
)
|
)
|
||||||
.arg(paths_arg());
|
.arg(paths_arg());
|
||||||
let edit_command = SubCommand::with_name("edit")
|
let edit_command = App::new("edit")
|
||||||
.about("Edit the content changes in a revision")
|
.about("Edit the content changes in a revision")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Lets you interactively edit the content changes in a revision.
|
"Lets you interactively edit the content changes in a revision.
|
||||||
|
@ -1065,7 +1065,7 @@ Starts a diff editor (`meld` by default) on the changes in the revision. Edit th
|
||||||
changes into or out of the parent revision.",
|
changes into or out of the parent revision.",
|
||||||
)
|
)
|
||||||
.arg(rev_arg().help("The revision to edit"));
|
.arg(rev_arg().help("The revision to edit"));
|
||||||
let split_command = SubCommand::with_name("split")
|
let split_command = App::new("split")
|
||||||
.about("Split a revision in two")
|
.about("Split a revision in two")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Lets you interactively split a revision in two.
|
"Lets you interactively split a revision in two.
|
||||||
|
@ -1077,7 +1077,7 @@ Starts a diff editor (`meld` by default) on the changes in the revision. Edit th
|
||||||
description for each.",
|
description for each.",
|
||||||
)
|
)
|
||||||
.arg(rev_arg().help("The revision to split"));
|
.arg(rev_arg().help("The revision to split"));
|
||||||
let merge_command = SubCommand::with_name("merge")
|
let merge_command = App::new("merge")
|
||||||
.about("Merge work from multiple branches")
|
.about("Merge work from multiple branches")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Merge work from multiple branches.
|
"Merge work from multiple branches.
|
||||||
|
@ -1088,13 +1088,13 @@ Unlike most other VCSs, `jj merge` does not implicitly include the working copy
|
||||||
resulting revision if you want to.",
|
resulting revision if you want to.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revisions")
|
Arg::new("revisions")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.multiple(true),
|
.multiple_occurrences(true),
|
||||||
)
|
)
|
||||||
.arg(message_arg().help("The change description to use (don't open editor)"));
|
.arg(message_arg().help("The change description to use (don't open editor)"));
|
||||||
let rebase_command = SubCommand::with_name("rebase")
|
let rebase_command = App::new("rebase")
|
||||||
.about("Move a revision to a different parent")
|
.about("Move a revision to a different parent")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Move a revision to a different parent.
|
"Move a revision to a different parent.
|
||||||
|
@ -1123,9 +1123,9 @@ D B'
|
||||||
A A",
|
A A",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("revision")
|
Arg::new("revision")
|
||||||
.long("revision")
|
.long("revision")
|
||||||
.short("r")
|
.short('r')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help(
|
.help(
|
||||||
"Rebase only this revision, rebasing descendants onto this revision's \
|
"Rebase only this revision, rebasing descendants onto this revision's \
|
||||||
|
@ -1133,38 +1133,38 @@ A A",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("source")
|
Arg::new("source")
|
||||||
.long("source")
|
.long("source")
|
||||||
.short("s")
|
.short('s')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(false)
|
.required(false)
|
||||||
.multiple(false)
|
.multiple_occurrences(false)
|
||||||
.help("Rebase this revision and its descendants"),
|
.help("Rebase this revision and its descendants"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("destination")
|
Arg::new("destination")
|
||||||
.long("destination")
|
.long("destination")
|
||||||
.short("d")
|
.short('d')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
.required(true)
|
||||||
.multiple(true)
|
.multiple_occurrences(true)
|
||||||
.help("The revision to rebase onto"),
|
.help("The revision to rebase onto"),
|
||||||
);
|
);
|
||||||
// TODO: It seems better to default the destination to `@-`. Maybe the working
|
// TODO: It seems better to default the destination to `@-`. Maybe the working
|
||||||
// copy should be rebased on top?
|
// copy should be rebased on top?
|
||||||
let backout_command = SubCommand::with_name("backout")
|
let backout_command = App::new("backout")
|
||||||
.about("Apply the reverse of a revision on top of another revision")
|
.about("Apply the reverse of a revision on top of another revision")
|
||||||
.arg(rev_arg().help("The revision to apply the reverse of"))
|
.arg(rev_arg().help("The revision to apply the reverse of"))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("destination")
|
Arg::new("destination")
|
||||||
.long("destination")
|
.long("destination")
|
||||||
.short("d")
|
.short('d')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("@")
|
.default_value("@")
|
||||||
.multiple(true)
|
.multiple_occurrences(true)
|
||||||
.help("The revision to apply the reverse changes on top of"),
|
.help("The revision to apply the reverse changes on top of"),
|
||||||
);
|
);
|
||||||
let branch_command = SubCommand::with_name("branch")
|
let branch_command = App::new("branch")
|
||||||
.about("Create, update, or delete a branch")
|
.about("Create, update, or delete a branch")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Create, update, or delete a branch. For information about branches, see \
|
"Create, update, or delete a branch. For information about branches, see \
|
||||||
|
@ -1172,12 +1172,12 @@ A A",
|
||||||
)
|
)
|
||||||
.arg(rev_arg().help("The branch's target revision"))
|
.arg(rev_arg().help("The branch's target revision"))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("allow-backwards")
|
Arg::new("allow-backwards")
|
||||||
.long("allow-backwards")
|
.long("allow-backwards")
|
||||||
.help("Allow moving the branch backwards or sideways"),
|
.help("Allow moving the branch backwards or sideways"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("delete")
|
Arg::new("delete")
|
||||||
.long("delete")
|
.long("delete")
|
||||||
.help("Delete the branch locally")
|
.help("Delete the branch locally")
|
||||||
.long_help(
|
.long_help(
|
||||||
|
@ -1186,7 +1186,7 @@ A A",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("forget")
|
Arg::new("forget")
|
||||||
.long("forget")
|
.long("forget")
|
||||||
.help("Forget the branch")
|
.help("Forget the branch")
|
||||||
.long_help(
|
.long_help(
|
||||||
|
@ -1197,25 +1197,23 @@ A A",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("name")
|
Arg::new("name")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("The name of the branch to move or delete"),
|
.help("The name of the branch to move or delete"),
|
||||||
);
|
);
|
||||||
let branches_command = SubCommand::with_name("branches")
|
let branches_command = App::new("branches").about("List branches").long_about(
|
||||||
.about("List branches")
|
"\
|
||||||
.long_about(
|
|
||||||
"\
|
|
||||||
List branches and their targets. A remote branch will be included only if its target is different \
|
List branches and their targets. A remote branch will be included only if its target is different \
|
||||||
from the local target. For a conflicted branch (both local and remote), old target \
|
from the local target. For a conflicted branch (both local and remote), old target \
|
||||||
revisions are preceded by a \"-\" and new target revisions are preceded by a \"+\".
|
revisions are preceded by a \"-\" and new target revisions are preceded by a \"+\".
|
||||||
|
|
||||||
For information about branches, see https://github.com/martinvonz/jj/blob/main/docs/branches.md",
|
For information about branches, see https://github.com/martinvonz/jj/blob/main/docs/branches.md",
|
||||||
);
|
);
|
||||||
let undo_command = SubCommand::with_name("undo")
|
let undo_command = App::new("undo")
|
||||||
.about("Undo an operation")
|
.about("Undo an operation")
|
||||||
.arg(op_arg().help("The operation to undo"));
|
.arg(op_arg().help("The operation to undo"));
|
||||||
let operation_command = SubCommand::with_name("operation")
|
let operation_command = App::new("operation")
|
||||||
.alias("op")
|
.alias("op")
|
||||||
.about("Commands for working with the operation log")
|
.about("Commands for working with the operation log")
|
||||||
.long_about(
|
.long_about(
|
||||||
|
@ -1223,15 +1221,15 @@ For information about branches, see https://github.com/martinvonz/jj/blob/main/d
|
||||||
operation log, see https://github.com/martinvonz/jj/blob/main/docs/operation-log.md.",
|
operation log, see https://github.com/martinvonz/jj/blob/main/docs/operation-log.md.",
|
||||||
)
|
)
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(SubCommand::with_name("log").about("Show the operation log"))
|
.subcommand(App::new("log").about("Show the operation log"))
|
||||||
.subcommand(undo_command.clone())
|
.subcommand(undo_command.clone())
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("restore")
|
App::new("restore")
|
||||||
.about("Restore to the state at an operation")
|
.about("Restore to the state at an operation")
|
||||||
.arg(op_arg().help("The operation to restore to")),
|
.arg(op_arg().help("The operation to restore to")),
|
||||||
);
|
);
|
||||||
let undo_command = undo_command.about("Undo an operation (shortcut for `jj op undo`)");
|
let undo_command = undo_command.about("Undo an operation (shortcut for `jj op undo`)");
|
||||||
let git_command = SubCommand::with_name("git")
|
let git_command = App::new("git")
|
||||||
.about("Commands for working with the underlying Git repo")
|
.about("Commands for working with the underlying Git repo")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Commands for working with the underlying Git repo.
|
"Commands for working with the underlying Git repo.
|
||||||
|
@ -1242,30 +1240,30 @@ https://github.com/martinvonz/jj/blob/main/docs/git-comparison.md.\
|
||||||
)
|
)
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("remote")
|
App::new("remote")
|
||||||
.about("Manage Git remotes")
|
.about("Manage Git remotes")
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("add")
|
App::new("add")
|
||||||
.about("Add a Git remote")
|
.about("Add a Git remote")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("remote")
|
Arg::new("remote")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("The remote's name"),
|
.help("The remote's name"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("url")
|
Arg::new("url")
|
||||||
.index(2)
|
.index(2)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("The remote's URL"),
|
.help("The remote's URL"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("remove")
|
App::new("remove")
|
||||||
.about("Remove a Git remote and forget its branches")
|
.about("Remove a Git remote and forget its branches")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("remote")
|
Arg::new("remote")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("The remote's name"),
|
.help("The remote's name"),
|
||||||
|
@ -1273,10 +1271,10 @@ https://github.com/martinvonz/jj/blob/main/docs/git-comparison.md.\
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("fetch")
|
App::new("fetch")
|
||||||
.about("Fetch from a Git remote")
|
.about("Fetch from a Git remote")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("remote")
|
Arg::new("remote")
|
||||||
.long("remote")
|
.long("remote")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("origin")
|
.default_value("origin")
|
||||||
|
@ -1284,26 +1282,26 @@ https://github.com/martinvonz/jj/blob/main/docs/git-comparison.md.\
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("clone")
|
App::new("clone")
|
||||||
.about("Create a new repo backed by a clone of a Git repo")
|
.about("Create a new repo backed by a clone of a Git repo")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Create a new repo backed by a clone of a Git repo. The Git repo will be a \
|
"Create a new repo backed by a clone of a Git repo. The Git repo will be a \
|
||||||
bare git repo stored inside the `.jj/` directory.",
|
bare git repo stored inside the `.jj/` directory.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("source")
|
Arg::new("source")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("URL or path of the Git repo to clone"),
|
.help("URL or path of the Git repo to clone"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("destination")
|
Arg::new("destination")
|
||||||
.index(2)
|
.index(2)
|
||||||
.help("The directory to write the Jujutsu repo to"),
|
.help("The directory to write the Jujutsu repo to"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("push")
|
App::new("push")
|
||||||
.about("Push to a Git remote")
|
.about("Push to a Git remote")
|
||||||
.long_about(
|
.long_about(
|
||||||
"Push to a Git remote
|
"Push to a Git remote
|
||||||
|
@ -1311,13 +1309,13 @@ https://github.com/martinvonz/jj/blob/main/docs/git-comparison.md.\
|
||||||
By default, all branches are pushed. Use `--branch` if you want to push only one branch.",
|
By default, all branches are pushed. Use `--branch` if you want to push only one branch.",
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("branch")
|
Arg::new("branch")
|
||||||
.long("branch")
|
.long("branch")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Push only this branch"),
|
.help("Push only this branch"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("remote")
|
Arg::new("remote")
|
||||||
.long("remote")
|
.long("remote")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value("origin")
|
.default_value("origin")
|
||||||
|
@ -1325,91 +1323,80 @@ By default, all branches are pushed. Use `--branch` if you want to push only one
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("import")
|
App::new("import")
|
||||||
.about("Update repo with changes made in the underlying Git repo"),
|
.about("Update repo with changes made in the underlying Git repo"),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("export")
|
App::new("export")
|
||||||
.about("Update the underlying Git repo with changes made in the repo"),
|
.about("Update the underlying Git repo with changes made in the repo"),
|
||||||
);
|
);
|
||||||
let bench_command = SubCommand::with_name("bench")
|
let bench_command = App::new("bench")
|
||||||
.about("Commands for benchmarking internal operations")
|
.about("Commands for benchmarking internal operations")
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("commonancestors")
|
App::new("commonancestors")
|
||||||
.about("Find the common ancestor(s) of a set of commits")
|
.about("Find the common ancestor(s) of a set of commits")
|
||||||
.arg(Arg::with_name("revision1").index(1).required(true))
|
.arg(Arg::new("revision1").index(1).required(true))
|
||||||
.arg(Arg::with_name("revision2").index(2).required(true)),
|
.arg(Arg::new("revision2").index(2).required(true)),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("isancestor")
|
App::new("isancestor")
|
||||||
.about("Checks if the first commit is an ancestor of the second commit")
|
.about("Checks if the first commit is an ancestor of the second commit")
|
||||||
.arg(Arg::with_name("ancestor").index(1).required(true))
|
.arg(Arg::new("ancestor").index(1).required(true))
|
||||||
.arg(Arg::with_name("descendant").index(2).required(true)),
|
.arg(Arg::new("descendant").index(2).required(true)),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("walkrevs")
|
App::new("walkrevs")
|
||||||
.about(
|
.about(
|
||||||
"Walk revisions that are ancestors of the second argument but not ancestors \
|
"Walk revisions that are ancestors of the second argument but not ancestors \
|
||||||
of the first",
|
of the first",
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name("unwanted").index(1).required(true))
|
.arg(Arg::new("unwanted").index(1).required(true))
|
||||||
.arg(Arg::with_name("wanted").index(2).required(true)),
|
.arg(Arg::new("wanted").index(2).required(true)),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("resolveprefix")
|
App::new("resolveprefix")
|
||||||
.about("Resolve a commit ID prefix")
|
.about("Resolve a commit ID prefix")
|
||||||
.arg(Arg::with_name("prefix").index(1).required(true)),
|
.arg(Arg::new("prefix").index(1).required(true)),
|
||||||
);
|
);
|
||||||
let debug_command = SubCommand::with_name("debug")
|
let debug_command = App::new("debug")
|
||||||
.about("Low-level commands not intended for users")
|
.about("Low-level commands not intended for users")
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("completion")
|
App::new("completion")
|
||||||
.about("Print a command-line-completion script")
|
.about("Print a command-line-completion script")
|
||||||
.arg(Arg::with_name("bash").long("bash"))
|
.arg(Arg::new("bash").long("bash"))
|
||||||
.arg(Arg::with_name("fish").long("fish"))
|
.arg(Arg::new("fish").long("fish"))
|
||||||
.arg(Arg::with_name("zsh").long("zsh")),
|
.arg(Arg::new("zsh").long("zsh")),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("resolverev")
|
App::new("resolverev")
|
||||||
.about("Resolve a revision identifier to its full ID")
|
.about("Resolve a revision identifier to its full ID")
|
||||||
.arg(rev_arg()),
|
.arg(rev_arg()),
|
||||||
)
|
)
|
||||||
|
.subcommand(App::new("workingcopy").about("Show information about the working copy state"))
|
||||||
|
.subcommand(App::new("writeworkingcopy").about("Write a tree from the working copy state"))
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("workingcopy")
|
App::new("template")
|
||||||
.about("Show information about the working copy state"),
|
|
||||||
)
|
|
||||||
.subcommand(
|
|
||||||
SubCommand::with_name("writeworkingcopy")
|
|
||||||
.about("Write a tree from the working copy state"),
|
|
||||||
)
|
|
||||||
.subcommand(
|
|
||||||
SubCommand::with_name("template")
|
|
||||||
.about("Parse a template")
|
.about("Parse a template")
|
||||||
.arg(Arg::with_name("template").index(1).required(true)),
|
.arg(Arg::new("template").index(1).required(true)),
|
||||||
)
|
)
|
||||||
.subcommand(SubCommand::with_name("index").about("Show commit index stats"))
|
.subcommand(App::new("index").about("Show commit index stats"))
|
||||||
.subcommand(SubCommand::with_name("reindex").about("Rebuild commit index"));
|
.subcommand(App::new("reindex").about("Rebuild commit index"));
|
||||||
let help_message = "Print help information, more help with --help than with -h";
|
let mut app = App::new("jj")
|
||||||
let mut app = App::new("Jujutsu")
|
|
||||||
.global_setting(clap::AppSettings::ColoredHelp)
|
|
||||||
.global_setting(clap::AppSettings::VersionlessSubcommands)
|
|
||||||
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.author("Martin von Zweigbergk <martinvonz@google.com>")
|
.author("Martin von Zweigbergk <martinvonz@google.com>")
|
||||||
.about(
|
.about(
|
||||||
"An experimental VCS
|
"Jujutsu (An experimental VCS)
|
||||||
|
|
||||||
To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/docs/tutorial.md.\
|
To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/docs/tutorial.md.\
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.help_message(help_message)
|
|
||||||
.version_message("Print version information")
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("repository")
|
Arg::new("repository")
|
||||||
.long("repository")
|
.long("repository")
|
||||||
.short("R")
|
.short('R')
|
||||||
.global(true)
|
.global(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.default_value(".")
|
.default_value(".")
|
||||||
|
@ -1420,7 +1407,7 @@ To get started, see the tutorial at https://github.com/martinvonz/jj/blob/main/d
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("at_op")
|
Arg::new("at_op")
|
||||||
.long("at-operation")
|
.long("at-operation")
|
||||||
.alias("at-op")
|
.alias("at-op")
|
||||||
.global(true)
|
.global(true)
|
||||||
|
@ -1446,6 +1433,9 @@ It is possible to mutating commands when loading the repo at an earlier operatio
|
||||||
",
|
",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
// TODO: We should also set the help message on sub-sub-commands etc.
|
||||||
|
let help_message = "Print help information, more help with --help than with -h";
|
||||||
|
app = app.mut_arg("help", |arg| arg.help(help_message));
|
||||||
for subcommand in [
|
for subcommand in [
|
||||||
init_command,
|
init_command,
|
||||||
checkout_command,
|
checkout_command,
|
||||||
|
@ -1478,7 +1468,7 @@ It is possible to mutating commands when loading the repo at an earlier operatio
|
||||||
bench_command,
|
bench_command,
|
||||||
debug_command,
|
debug_command,
|
||||||
] {
|
] {
|
||||||
app = app.subcommand(subcommand.help_message(help_message));
|
app = app.subcommand(subcommand.mut_arg("help", |arg| arg.help(help_message)));
|
||||||
}
|
}
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
|
@ -3315,13 +3305,13 @@ fn cmd_debug(ui: &mut Ui, command: &CommandHelper, args: &ArgMatches) -> Result<
|
||||||
let mut app = get_app();
|
let mut app = get_app();
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
let shell = if complation_matches.is_present("zsh") {
|
let shell = if complation_matches.is_present("zsh") {
|
||||||
clap::Shell::Zsh
|
clap_complete::Shell::Zsh
|
||||||
} else if complation_matches.is_present("fish") {
|
} else if complation_matches.is_present("fish") {
|
||||||
clap::Shell::Fish
|
clap_complete::Shell::Fish
|
||||||
} else {
|
} else {
|
||||||
clap::Shell::Bash
|
clap_complete::Shell::Bash
|
||||||
};
|
};
|
||||||
app.gen_completions_to("jj", shell, &mut buf);
|
clap_complete::generate(shell, &mut app, "jj", &mut buf);
|
||||||
ui.stdout_formatter().write_all(&buf)?;
|
ui.stdout_formatter().write_all(&buf)?;
|
||||||
} else if let Some(resolve_matches) = args.subcommand_matches("resolverev") {
|
} else if let Some(resolve_matches) = args.subcommand_matches("resolverev") {
|
||||||
let mut workspace_command = command.workspace_helper(ui)?;
|
let mut workspace_command = command.workspace_helper(ui)?;
|
||||||
|
|
Loading…
Reference in a new issue