Skip to content

Make rustup install a true alias of rustup toolchain install. #2096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
@@ -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
119 changes: 49 additions & 70 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
@@ -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")
@@ -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")
@@ -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")