Skip to content
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

Consistently give toolchain argument a help text #1212

Merged
merged 1 commit into from
Aug 13, 2017
Merged
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
17 changes: 7 additions & 10 deletions src/rustup-cli/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,13 @@ r"DISCUSSION:
updates rustup itself.

If given a toolchain argument then `update` updates that
toolchain, the same as `rustup toolchain install`.

'toolchain' specifies a toolchain name, such as 'stable',
'nightly', or '1.8.0'. For more information see `rustup help
toolchain`.";
toolchain, the same as `rustup toolchain install`.";

pub static INSTALL_HELP: &'static str =
r"DISCUSSION:
Installs a specific rust toolchain.

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

'toolchain' specifies a toolchain name, such as 'stable',
'nightly', or '1.8.0'. For more information see `rustup help
toolchain`.";
The 'install' command is an alias for 'rustup update <toolchain>'.";

pub static DEFAULT_HELP: &'static str =
r"DISCUSSION:
Expand Down Expand Up @@ -260,3 +252,8 @@ r"DISCUSSION:
completions into our profile simply use

PS C:\> rustup completions powershell >> %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1";

pub static TOOLCHAIN_ARG_HELP: &'static str =
"Toolchain name, such as 'stable', 'nightly', \
or '1.8.0'. For more information see `rustup \
help toolchain`";
16 changes: 16 additions & 0 deletions src/rustup-cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,21 @@ pub fn cli() -> App<'static, 'static> {
.after_help(INSTALL_HELP)
.setting(AppSettings::Hidden) // synonym for 'toolchain install'
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true)))
.subcommand(SubCommand::with_name("uninstall")
.about("Uninstall Rust toolchains")
.setting(AppSettings::Hidden) // synonym for 'toolchain uninstall'
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true)))
.subcommand(SubCommand::with_name("update")
.about("Update Rust toolchains and rustup")
.after_help(UPDATE_HELP)
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(false)
.multiple(true))
.arg(Arg::with_name("no-self-update")
Expand All @@ -146,6 +149,7 @@ pub fn cli() -> App<'static, 'static> {
.about("Set the default toolchain")
.after_help(DEFAULT_HELP)
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)))
.subcommand(SubCommand::with_name("toolchain")
.about("Modify or query the installed toolchains")
Expand All @@ -159,18 +163,21 @@ pub fn cli() -> App<'static, 'static> {
.about("Install or update a given toolchain")
.aliases(&["update", "add"])
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true)))
.subcommand(SubCommand::with_name("uninstall")
.about("Uninstall a toolchain")
.alias("remove")
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)
.multiple(true)))
.subcommand(SubCommand::with_name("link")
.about("Create a custom toolchain by symlinking to a directory")
.after_help(TOOLCHAIN_LINK_HELP)
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true))
.arg(Arg::with_name("path")
.required(true))))
Expand All @@ -182,6 +189,7 @@ pub fn cli() -> App<'static, 'static> {
.subcommand(SubCommand::with_name("list")
.about("List installed and available targets")
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true)))
.subcommand(SubCommand::with_name("add")
Expand All @@ -191,6 +199,7 @@ pub fn cli() -> App<'static, 'static> {
.required(true)
.multiple(true))
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true)))
.subcommand(SubCommand::with_name("remove")
Expand All @@ -200,6 +209,7 @@ pub fn cli() -> App<'static, 'static> {
.required(true)
.multiple(true))
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true))))
.subcommand(SubCommand::with_name("component")
Expand All @@ -210,6 +220,7 @@ pub fn cli() -> App<'static, 'static> {
.subcommand(SubCommand::with_name("list")
.about("List installed and available components")
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true)))
.subcommand(SubCommand::with_name("add")
Expand All @@ -218,6 +229,7 @@ pub fn cli() -> App<'static, 'static> {
.required(true)
.multiple(true))
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true))
.arg(Arg::with_name("target")
Expand All @@ -229,6 +241,7 @@ pub fn cli() -> App<'static, 'static> {
.required(true)
.multiple(true))
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true))
.arg(Arg::with_name("target")
Expand All @@ -246,6 +259,7 @@ pub fn cli() -> App<'static, 'static> {
.about("Set the override toolchain for a directory")
.alias("add")
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true)))
.subcommand(SubCommand::with_name("unset")
.about("Remove the override toolchain for a directory")
Expand All @@ -264,6 +278,7 @@ pub fn cli() -> App<'static, 'static> {
.after_help(RUN_HELP)
.setting(AppSettings::TrailingVarArg)
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.required(true))
.arg(Arg::with_name("command")
.required(true).multiple(true).use_delimiter(false)))
Expand Down Expand Up @@ -291,6 +306,7 @@ pub fn cli() -> App<'static, 'static> {
.arg(Arg::with_name("command")
.required(true))
.arg(Arg::with_name("toolchain")
.help(TOOLCHAIN_ARG_HELP)
.long("toolchain")
.takes_value(true)));
}
Expand Down