Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 47 additions & 42 deletions src/rustup-cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn main() -> Result<()> {
}

pub fn cli() -> App<'static, 'static> {
App::new("rustup")
let mut app = App::new("rustup")
.version(common::version())
.about("The Rust toolchain installer")
.after_help(RUSTUP_HELP)
Expand Down Expand Up @@ -330,52 +330,57 @@ pub fn cli() -> App<'static, 'static> {
.long("std")
.help("Standard library API documentation"))
.group(ArgGroup::with_name("page")
.args(&["book", "std"])))
.subcommand(SubCommand::with_name("man")
.args(&["book", "std"])));

if cfg!(not(target_os = "windows")) {
app = app
.subcommand(SubCommand::with_name("man")
.about("View the man page for a given command")
.arg(Arg::with_name("command")
.required(true))
.arg(Arg::with_name("toolchain")
.long("toolchain")
.takes_value(true)))
.subcommand(SubCommand::with_name("self")
.about("Modify the rustup installation")
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("update")
.about("Download and install updates to rustup"))
.subcommand(SubCommand::with_name("uninstall")
.about("Uninstall rustup.")
.arg(Arg::with_name("no-prompt")
.short("y")))
.subcommand(SubCommand::with_name("upgrade-data")
.about("Upgrade the internal data format.")))
.subcommand(SubCommand::with_name("telemetry")
.about("rustup telemetry commands")
.setting(AppSettings::Hidden)
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("enable")
.about("Enable rustup telemetry"))
.subcommand(SubCommand::with_name("disable")
.about("Disable rustup telemetry"))
.subcommand(SubCommand::with_name("analyze")
.about("Analyze stored telemetry")))
.subcommand(SubCommand::with_name("set")
.about("Alter rustup settings")
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("default-host")
.about("The triple used to identify toolchains when not specified")
.arg(Arg::with_name("host_triple")
.required(true))))
.subcommand(SubCommand::with_name("completions")
.about("Generate completion scripts for your shell")
.after_help(COMPLETIONS_HELP)
.setting(AppSettings::ArgRequiredElseHelp)
.arg(Arg::with_name("shell")
.possible_values(&Shell::variants())))
.takes_value(true)));
}

app.subcommand(SubCommand::with_name("self")
.about("Modify the rustup installation")
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("update")
.about("Download and install updates to rustup"))
.subcommand(SubCommand::with_name("uninstall")
.about("Uninstall rustup.")
.arg(Arg::with_name("no-prompt")
.short("y")))
.subcommand(SubCommand::with_name("upgrade-data")
.about("Upgrade the internal data format.")))
.subcommand(SubCommand::with_name("telemetry")
.about("rustup telemetry commands")
.setting(AppSettings::Hidden)
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("enable")
.about("Enable rustup telemetry"))
.subcommand(SubCommand::with_name("disable")
.about("Disable rustup telemetry"))
.subcommand(SubCommand::with_name("analyze")
.about("Analyze stored telemetry")))
.subcommand(SubCommand::with_name("set")
.about("Alter rustup settings")
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("default-host")
.about("The triple used to identify toolchains when not specified")
.arg(Arg::with_name("host_triple")
.required(true))))
.subcommand(SubCommand::with_name("completions")
.about("Generate completion scripts for your shell")
.after_help(COMPLETIONS_HELP)
.setting(AppSettings::ArgRequiredElseHelp)
.arg(Arg::with_name("shell")
.possible_values(&Shell::variants())))
}

fn maybe_upgrade_data(cfg: &Cfg, m: &ArgMatches) -> Result<bool> {
Expand Down