return Ok(());
}
+ if args.subcommand_name().is_none() {
+ cli().print_help()?;
+ return Ok(());
+ }
+
execute_subcommand(config, args)
}
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 <command>' for more information on a specific command."
+ )
.arg(
opt("version", "Print version info and exit")
.short("V")
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 <command>' for more information on a specific command.
-")
.subcommands(commands::builtin())
;
app