From: Aleksey Kladov Date: Sat, 10 Mar 2018 14:35:18 +0000 (+0300) Subject: Tweak the help message X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~47^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c180e17666ae5efc2347af8209ad6c8316bb31c9;p=cargo.git Tweak the help message --- diff --git a/src/bin/cli.rs b/src/bin/cli.rs index 7e5c45538..d24ad2fc3 100644 --- a/src/bin/cli.rs +++ b/src/bin/cli.rs @@ -69,6 +69,11 @@ pub fn do_main(config: &mut Config) -> CliResult { return Ok(()); } + if args.subcommand_name().is_none() { + cli().print_help()?; + return Ok(()); + } + execute_subcommand(config, args) } @@ -566,13 +571,39 @@ fn execute_subcommand(config: &mut Config, args: ArgMatches) -> CliResult { fn cli() -> App { let app = App::new("cargo") .settings(&[ - AppSettings::DisableVersion, AppSettings::UnifiedHelpMessage, AppSettings::DeriveDisplayOrder, AppSettings::VersionlessSubcommands, AppSettings::AllowExternalSubcommands, ]) - .about("Rust's package manager") + .about("") + .template("\ +Rust's package manager + +USAGE: + {usage} + +OPTIONS: +{unified} + +Some common cargo commands are (see all commands with --list): + build Compile the current project + check Analyze the current project and report errors, but don't build object files + clean Remove the target directory + doc Build this project's and its dependencies' documentation + new Create a new cargo project + init Create a new cargo project in an existing directory + run Build and execute src/main.rs + test Run the tests + bench Run the benchmarks + update Update dependencies listed in Cargo.lock + search Search registry for crates + publish Package and upload this project to the registry + install Install a Rust binary + uninstall Uninstall a Rust binary + +See 'cargo help ' for more information on a specific command." + ) .arg( opt("version", "Print version info and exit") .short("V") @@ -608,25 +639,6 @@ fn cli() -> App { Arg::with_name("unstable-features").help("Unstable (nightly-only) flags to Cargo") .short("Z").value_name("FLAG").multiple(true).global(true) ) - .after_help("\ -Some common cargo commands are (see all commands with --list): - build Compile the current project - check Analyze the current project and report errors, but don't build object files - clean Remove the target directory - doc Build this project's and its dependencies' documentation - new Create a new cargo project - init Create a new cargo project in an existing directory - run Build and execute src/main.rs - test Run the tests - bench Run the benchmarks - update Update dependencies listed in Cargo.lock - search Search registry for crates - publish Package and upload this project to the registry - install Install a Rust binary - uninstall Uninstall a Rust binary - -See 'cargo help ' for more information on a specific command. -") .subcommands(commands::builtin()) ; app