mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-24 16:41:11 +00:00
cli: remove unnecessary override of --help
description on subcommands
It turns out that the `--help` option is "global", so the description we set on the top-level command already applies to subcommands (and subsubcommands, etc.).
This commit is contained in:
parent
67b731b34a
commit
c47bb9373c
@ -1383,7 +1383,7 @@ By default, all branches are pushed. Use `--branch` if you want to push only one
|
|||||||
)
|
)
|
||||||
.subcommand(App::new("index").about("Show commit index stats"))
|
.subcommand(App::new("index").about("Show commit index stats"))
|
||||||
.subcommand(App::new("reindex").about("Rebuild commit index"));
|
.subcommand(App::new("reindex").about("Rebuild commit index"));
|
||||||
let mut app = App::new("jj")
|
App::new("jj")
|
||||||
.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>")
|
||||||
@ -1393,6 +1393,9 @@ By default, all branches are pushed. Use `--branch` if you want to push only one
|
|||||||
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.\
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
.mut_arg("help", |arg| {
|
||||||
|
arg.help("Print help information, more help with --help than with -h")
|
||||||
|
})
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("repository")
|
Arg::new("repository")
|
||||||
.long("repository")
|
.long("repository")
|
||||||
@ -1432,45 +1435,37 @@ It is possible to mutating commands when loading the repo at an earlier operatio
|
|||||||
operation. There's rarely a reason to do that, but it is possible.
|
operation. There's rarely a reason to do that, but it is possible.
|
||||||
",
|
",
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
// TODO: We should also set the help message on sub-sub-commands etc.
|
.subcommand(init_command)
|
||||||
let help_message = "Print help information, more help with --help than with -h";
|
.subcommand(checkout_command)
|
||||||
app = app.mut_arg("help", |arg| arg.help(help_message));
|
.subcommand(untrack_command)
|
||||||
for subcommand in [
|
.subcommand(files_command)
|
||||||
init_command,
|
.subcommand(diff_command)
|
||||||
checkout_command,
|
.subcommand(show_command)
|
||||||
untrack_command,
|
.subcommand(status_command)
|
||||||
files_command,
|
.subcommand(log_command)
|
||||||
diff_command,
|
.subcommand(obslog_command)
|
||||||
show_command,
|
.subcommand(describe_command)
|
||||||
status_command,
|
.subcommand(close_command)
|
||||||
log_command,
|
.subcommand(open_command)
|
||||||
obslog_command,
|
.subcommand(duplicate_command)
|
||||||
describe_command,
|
.subcommand(abandon_command)
|
||||||
close_command,
|
.subcommand(new_command)
|
||||||
open_command,
|
.subcommand(squash_command)
|
||||||
duplicate_command,
|
.subcommand(unsquash_command)
|
||||||
abandon_command,
|
.subcommand(restore_command)
|
||||||
new_command,
|
.subcommand(edit_command)
|
||||||
squash_command,
|
.subcommand(split_command)
|
||||||
unsquash_command,
|
.subcommand(merge_command)
|
||||||
restore_command,
|
.subcommand(rebase_command)
|
||||||
edit_command,
|
.subcommand(backout_command)
|
||||||
split_command,
|
.subcommand(branch_command)
|
||||||
merge_command,
|
.subcommand(branches_command)
|
||||||
rebase_command,
|
.subcommand(operation_command)
|
||||||
backout_command,
|
.subcommand(undo_command)
|
||||||
branch_command,
|
.subcommand(git_command)
|
||||||
branches_command,
|
.subcommand(bench_command)
|
||||||
operation_command,
|
.subcommand(debug_command)
|
||||||
undo_command,
|
|
||||||
git_command,
|
|
||||||
bench_command,
|
|
||||||
debug_command,
|
|
||||||
] {
|
|
||||||
app = app.subcommand(subcommand.mut_arg("help", |arg| arg.help(help_message)));
|
|
||||||
}
|
|
||||||
app
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn short_commit_description(commit: &Commit) -> String {
|
fn short_commit_description(commit: &Commit) -> String {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user