mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 18:27:38 +00:00
commands: split up definition of Clap App to help rustfmt
It seems the definition had gotten too large for rustfmt.
This commit is contained in:
parent
06401fc30d
commit
09e474a05a
1 changed files with 228 additions and 254 deletions
218
src/commands.rs
218
src/commands.rs
|
@ -260,21 +260,7 @@ fn update_checkout_after_rewrite(ui: &mut Ui, tx: &mut Transaction) {
|
|||
}
|
||||
|
||||
fn get_app<'a, 'b>() -> App<'a, 'b> {
|
||||
App::new("Jujube")
|
||||
.global_setting(clap::AppSettings::ColoredHelp)
|
||||
.version("0.0.1")
|
||||
.author("Martin von Zweigbergk <martinvonz@google.com>")
|
||||
.about("My source control tool")
|
||||
.arg(
|
||||
Arg::with_name("repository")
|
||||
.long("repository")
|
||||
.short("R")
|
||||
.takes_value(true)
|
||||
.default_value("."),
|
||||
)
|
||||
.arg(Arg::with_name("at_op").long("at-operation").alias("at-op").takes_value(true))
|
||||
.subcommand(
|
||||
SubCommand::with_name("init")
|
||||
let init_command = SubCommand::with_name("init")
|
||||
.about("initialize a repo")
|
||||
.arg(Arg::with_name("destination").index(1).default_value("."))
|
||||
.arg(
|
||||
|
@ -282,21 +268,15 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.long("git-store")
|
||||
.takes_value(true)
|
||||
.help("path to a .git backing store"),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("checkout")
|
||||
);
|
||||
let checkout_command = SubCommand::with_name("checkout")
|
||||
.alias("co")
|
||||
.about("update the working copy to another commit")
|
||||
.arg(Arg::with_name("revision").index(1).required(true)),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("files")
|
||||
.arg(Arg::with_name("revision").index(1).required(true));
|
||||
let files_command = SubCommand::with_name("files")
|
||||
.about("list files")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("diff")
|
||||
.arg(rev_arg());
|
||||
let diff_command = SubCommand::with_name("diff")
|
||||
.about("show modified files")
|
||||
.arg(
|
||||
Arg::with_name("summary")
|
||||
|
@ -304,21 +284,18 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.short("s")
|
||||
.help("show only the diff type (modified/added/removed)"),
|
||||
)
|
||||
.arg(Arg::with_name("revision")
|
||||
.arg(
|
||||
Arg::with_name("revision")
|
||||
.long("revision")
|
||||
.short("r")
|
||||
.takes_value(true)
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(Arg::with_name("from").long("from").takes_value(true))
|
||||
.arg(Arg::with_name("to").long("to").takes_value(true)),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("status")
|
||||
.arg(Arg::with_name("to").long("to").takes_value(true));
|
||||
let status_command = SubCommand::with_name("status")
|
||||
.alias("st")
|
||||
.about("show repo status"),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("log")
|
||||
.about("show repo status");
|
||||
let log_command = SubCommand::with_name("log")
|
||||
.about("show commit history")
|
||||
.arg(
|
||||
Arg::with_name("template")
|
||||
|
@ -327,10 +304,8 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.takes_value(true),
|
||||
)
|
||||
.arg(Arg::with_name("all").long("all"))
|
||||
.arg(Arg::with_name("no-graph").long("no-graph")),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("obslog")
|
||||
.arg(Arg::with_name("no-graph").long("no-graph"));
|
||||
let obslog_command = SubCommand::with_name("obslog")
|
||||
.about("show how a commit has evolved")
|
||||
.arg(rev_arg())
|
||||
.arg(
|
||||
|
@ -339,52 +314,34 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.short("T")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(Arg::with_name("no-graph").long("no-graph")),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("describe")
|
||||
.arg(Arg::with_name("no-graph").long("no-graph"));
|
||||
let describe_command = SubCommand::with_name("describe")
|
||||
.about("edit the commit description")
|
||||
.arg(rev_arg())
|
||||
.arg(Arg::with_name("text").long("text").takes_value(true))
|
||||
.arg(Arg::with_name("stdin").long("stdin")),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("close")
|
||||
.arg(Arg::with_name("stdin").long("stdin"));
|
||||
let close_command = SubCommand::with_name("close")
|
||||
.about("mark a commit closed, making new work go into a new commit")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("open")
|
||||
.arg(rev_arg());
|
||||
let open_command = SubCommand::with_name("open")
|
||||
.about("mark a commit open, making new work be added to it")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("duplicate")
|
||||
.arg(rev_arg());
|
||||
let duplicate_command = SubCommand::with_name("duplicate")
|
||||
.about("create a copy of the commit with a new change id")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("prune")
|
||||
.arg(rev_arg());
|
||||
let prune_command = SubCommand::with_name("prune")
|
||||
.about("create an empty successor of a commit")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("new")
|
||||
.arg(rev_arg());
|
||||
let new_command = SubCommand::with_name("new")
|
||||
.about("create a new, empty commit")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("squash")
|
||||
.arg(rev_arg());
|
||||
let squash_command = SubCommand::with_name("squash")
|
||||
.about("squash a commit into its parent")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("discard")
|
||||
.arg(rev_arg());
|
||||
let discard_command = SubCommand::with_name("discard")
|
||||
.about("discard a commit (and its descendants)")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("restore")
|
||||
.arg(rev_arg());
|
||||
let restore_command = SubCommand::with_name("restore")
|
||||
.about("restore paths from another revision")
|
||||
.arg(
|
||||
Arg::with_name("source")
|
||||
|
@ -400,39 +357,23 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.takes_value(true)
|
||||
.default_value("@"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("interactive")
|
||||
.long("interactive")
|
||||
.short("i"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("paths")
|
||||
.index(1)
|
||||
.multiple(true),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("edit")
|
||||
.arg(Arg::with_name("interactive").long("interactive").short("i"))
|
||||
.arg(Arg::with_name("paths").index(1).multiple(true));
|
||||
let edit_command = SubCommand::with_name("edit")
|
||||
.about("edit the content changes in a revision")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("split")
|
||||
.arg(rev_arg());
|
||||
let split_command = SubCommand::with_name("split")
|
||||
.about("split a revision in two")
|
||||
.arg(rev_arg()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("merge")
|
||||
.arg(rev_arg());
|
||||
let merge_command = SubCommand::with_name("merge")
|
||||
.about("merge work from multiple branches")
|
||||
.arg(
|
||||
Arg::with_name("revisions")
|
||||
.index(1)
|
||||
.required(true)
|
||||
.multiple(true),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("rebase")
|
||||
);
|
||||
let rebase_command = SubCommand::with_name("rebase")
|
||||
.about("move a commit to a different parent")
|
||||
.arg(rev_arg())
|
||||
.arg(
|
||||
|
@ -442,10 +383,8 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.takes_value(true)
|
||||
.required(true)
|
||||
.multiple(true),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("backout")
|
||||
);
|
||||
let backout_command = SubCommand::with_name("backout")
|
||||
.about("apply the reverse of a commit on top of another commit")
|
||||
.arg(rev_arg())
|
||||
.arg(
|
||||
|
@ -455,13 +394,10 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.takes_value(true)
|
||||
.default_value("@")
|
||||
.multiple(true),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("evolve").about("resolve problems with the repo's meta-history"),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("operation")
|
||||
);
|
||||
let evolve_command =
|
||||
SubCommand::with_name("evolve").about("resolve problems with the repo's meta-history");
|
||||
let operation_command = SubCommand::with_name("operation")
|
||||
.alias("op")
|
||||
.about("commands for working with the operation log")
|
||||
.subcommand(SubCommand::with_name("log").about("show the operation log"))
|
||||
|
@ -474,10 +410,8 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
SubCommand::with_name("restore")
|
||||
.about("restore to the state at an operation")
|
||||
.arg(op_arg()),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("bench")
|
||||
);
|
||||
let bench_command = SubCommand::with_name("bench")
|
||||
.about("commands for benchmarking internal operations")
|
||||
.subcommand(
|
||||
SubCommand::with_name("commonancestors")
|
||||
|
@ -501,10 +435,8 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
SubCommand::with_name("resolveprefix")
|
||||
.about("resolve a commit id prefix")
|
||||
.arg(Arg::with_name("prefix").index(1).required(true)),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("debug")
|
||||
);
|
||||
let debug_command = SubCommand::with_name("debug")
|
||||
.about("low-level commands not intended for users")
|
||||
.subcommand(
|
||||
SubCommand::with_name("resolverev")
|
||||
|
@ -525,8 +457,50 @@ fn get_app<'a, 'b>() -> App<'a, 'b> {
|
|||
.arg(Arg::with_name("template").index(1).required(true)),
|
||||
)
|
||||
.subcommand(SubCommand::with_name("index").about("show commit index stats"))
|
||||
.subcommand(SubCommand::with_name("reindex").about("rebuild commit index")),
|
||||
.subcommand(SubCommand::with_name("reindex").about("rebuild commit index"));
|
||||
App::new("Jujube")
|
||||
.global_setting(clap::AppSettings::ColoredHelp)
|
||||
.version("0.0.1")
|
||||
.author("Martin von Zweigbergk <martinvonz@google.com>")
|
||||
.about("My source control tool")
|
||||
.arg(
|
||||
Arg::with_name("repository")
|
||||
.long("repository")
|
||||
.short("R")
|
||||
.takes_value(true)
|
||||
.default_value("."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("at_op")
|
||||
.long("at-operation")
|
||||
.alias("at-op")
|
||||
.takes_value(true),
|
||||
)
|
||||
.subcommand(init_command)
|
||||
.subcommand(checkout_command)
|
||||
.subcommand(files_command)
|
||||
.subcommand(diff_command)
|
||||
.subcommand(status_command)
|
||||
.subcommand(log_command)
|
||||
.subcommand(obslog_command)
|
||||
.subcommand(describe_command)
|
||||
.subcommand(close_command)
|
||||
.subcommand(open_command)
|
||||
.subcommand(duplicate_command)
|
||||
.subcommand(prune_command)
|
||||
.subcommand(new_command)
|
||||
.subcommand(squash_command)
|
||||
.subcommand(discard_command)
|
||||
.subcommand(restore_command)
|
||||
.subcommand(edit_command)
|
||||
.subcommand(split_command)
|
||||
.subcommand(merge_command)
|
||||
.subcommand(rebase_command)
|
||||
.subcommand(backout_command)
|
||||
.subcommand(evolve_command)
|
||||
.subcommand(operation_command)
|
||||
.subcommand(bench_command)
|
||||
.subcommand(debug_command)
|
||||
}
|
||||
|
||||
fn cmd_init(
|
||||
|
|
Loading…
Reference in a new issue