Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/cli/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ pub static UPDATE_HELP: &str = r"DISCUSSION:
pub static INSTALL_HELP: &str = r"DISCUSSION:
Installs a specific rust toolchain.

The 'install' command is an alias for 'rustup update <toolchain>'.";
The 'install' command is an alias for:
rustup toolchain install <toolchain>
";

pub static DEFAULT_HELP: &str = r"DISCUSSION:
Sets the default toolchain to the one specified. If the toolchain
Expand Down
119 changes: 49 additions & 70 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,52 @@ pub fn main() -> Result<()> {
}

pub fn cli() -> App<'static, 'static> {
let toolchain_install = SubCommand::with_name("install")
.about("Install or update a given toolchain")
.arg(
Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true),
)
.arg(
Arg::with_name("profile")
.long("profile")
.takes_value(true)
.possible_values(Profile::names())
.required(false),
)
.arg(
Arg::with_name("no-self-update")
.help(
"Don't perform self update when running the `rustup toolchain install` command",
)
.long("no-self-update")
.takes_value(false),
)
.arg(
Arg::with_name("components")
.help("Add specific components on installation")
.long("component")
.short("c")
.takes_value(true)
.multiple(true),
)
.arg(
Arg::with_name("targets")
.help("Add specific targets on installation")
.long("target")
.short("t")
.takes_value(true)
.multiple(true),
)
.arg(
Arg::with_name("force")
.help("Force an update, even if some components are missing")
.long("force")
.takes_value(false),
);

let mut app = App::new("rustup")
.version(common::version())
.about("The Rust toolchain installer")
Expand Down Expand Up @@ -168,35 +214,10 @@ pub fn cli() -> App<'static, 'static> {
.subcommand(SubCommand::with_name("profile").about("Show the current profile")),
)
.subcommand(
SubCommand::with_name("install")
.about("Update Rust toolchains")
toolchain_install
.clone()
.after_help(INSTALL_HELP)
.setting(AppSettings::Hidden) // synonym for 'toolchain install'
.arg(
Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true),
)
.arg(
Arg::with_name("profile")
.long("profile")
.takes_value(true)
.possible_values(Profile::names())
.required(false)
)
.arg(
Arg::with_name("no-self-update")
.help("Don't perform self-update when running the `rustup install` command")
.long("no-self-update")
.takes_value(false)
)
.arg(
Arg::with_name("force")
.help("Force an update, even if some components are missing")
.long("force")
.takes_value(false),
),
)
.subcommand(
SubCommand::with_name("uninstall")
Expand Down Expand Up @@ -265,50 +286,8 @@ pub fn cli() -> App<'static, 'static> {
)
)
.subcommand(
SubCommand::with_name("install")
.about("Install or update a given toolchain")
toolchain_install
.aliases(&["update", "add"])
.arg(
Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true),
)
.arg(
Arg::with_name("profile")
.long("profile")
.takes_value(true)
.possible_values(Profile::names())
.required(false)
)
.arg(
Arg::with_name("no-self-update")
.help("Don't perform self update when running the `rustup toolchain install` command")
.long("no-self-update")
.takes_value(false)
)
.arg(
Arg::with_name("components")
.help("Add specific components on installation")
.long("component")
.short("c")
.takes_value(true)
.multiple(true)
)
.arg(
Arg::with_name("targets")
.help("Add specific targets on installation")
.long("target")
.short("t")
.takes_value(true)
.multiple(true)
)
.arg(
Arg::with_name("force")
.help("Force an update, even if some components are missing")
.long("force")
.takes_value(false),
),
)
.subcommand(
SubCommand::with_name("uninstall")
Expand Down