-
Notifications
You must be signed in to change notification settings - Fork 861
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
- Loading branch information
Showing
46 changed files
with
1,384 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use rustup::utils::utils; | ||
|
||
#[test] | ||
fn ui_tests() { | ||
let t = trycmd::TestCases::new(); | ||
let rustup_init = trycmd::cargo::cargo_bin("rustup-init"); | ||
let rustup = trycmd::cargo::cargo_bin("rustup"); | ||
t.register_bin("rustup-init", &rustup_init); | ||
// Copy rustup-init to rustup so that the tests can run it. | ||
utils::copy_file(&rustup_init, &rustup).unwrap(); | ||
t.register_bin("rustup", &rustup); | ||
t.case("tests/cli-ui/*.toml"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
bin.name = "rustup-init" | ||
args = ["--help"] | ||
status.code = 0 | ||
stdout = """ | ||
rustup-init [..] | ||
The installer for rustup | ||
USAGE: | ||
rustup-init [FLAGS] [OPTIONS] | ||
FLAGS: | ||
-v, --verbose Enable verbose output | ||
-q, --quiet Disable progress output | ||
-y Disable confirmation prompt. | ||
--no-update-default-toolchain Don't update any existing default toolchain after install | ||
--no-modify-path Don't configure the PATH environment variable | ||
-h, --help Prints help information | ||
-V, --version Prints version information | ||
OPTIONS: | ||
--default-host <default-host> Choose a default host triple | ||
--default-toolchain <default-toolchain> Choose a default toolchain to install | ||
--profile <profile> [default: default] [possible values: minimal, default, complete] | ||
-c, --component <components>... Component name to also install | ||
-t, --target <targets>... Target name to also install | ||
""" | ||
stderr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
bin.name = "rustup" | ||
args = ["check","--help"] | ||
stdout = """ | ||
rustup-check | ||
Check for updates to Rust toolchains and rustup | ||
USAGE: | ||
rustup check | ||
FLAGS: | ||
-h, --help Prints help information | ||
""" | ||
stderr = "" |
138 changes: 138 additions & 0 deletions
138
tests/cli-ui/rustup_completions_cmd_help_flag_stdout.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
bin.name = "rustup" | ||
args = ["completions","--help"] | ||
stdout = """ | ||
rustup-completions | ||
Generate tab-completion scripts for your shell | ||
USAGE: | ||
rustup completions [ARGS] | ||
FLAGS: | ||
-h, --help Prints help information | ||
ARGS: | ||
<shell> [possible values: zsh, bash, fish, powershell, elvish] | ||
<command> [possible values: rustup, cargo] | ||
DISCUSSION: | ||
Enable tab completion for Bash, Fish, Zsh, or PowerShell | ||
The script is output on `stdout`, allowing one to re-direct the | ||
output to the file of their choosing. Where you place the file | ||
will depend on which shell, and which operating system you are | ||
using. Your particular configuration may also determine where | ||
these scripts need to be placed. | ||
Here are some common set ups for the three supported shells under | ||
Unix and similar operating systems (such as GNU/Linux). | ||
BASH: | ||
Completion files are commonly stored in `/etc/bash_completion.d/` for | ||
system-wide commands, but can be stored in | ||
`~/.local/share/bash-completion/completions` for user-specific commands. | ||
Run the command: | ||
$ mkdir -p ~/.local/share/bash-completion/completions | ||
$ rustup completions bash >> ~/.local/share/bash-completion/completions/rustup | ||
This installs the completion script. You may have to log out and | ||
log back in to your shell session for the changes to take effect. | ||
BASH (macOS/Homebrew): | ||
Homebrew stores bash completion files within the Homebrew directory. | ||
With the `bash-completion` brew formula installed, run the command: | ||
$ mkdir -p $(brew --prefix)/etc/bash_completion.d | ||
$ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion | ||
FISH: | ||
Fish completion files are commonly stored in | ||
`$HOME/.config/fish/completions`. Run the command: | ||
$ mkdir -p ~/.config/fish/completions | ||
$ rustup completions fish > ~/.config/fish/completions/rustup.fish | ||
This installs the completion script. You may have to log out and | ||
log back in to your shell session for the changes to take effect. | ||
ZSH: | ||
ZSH completions are commonly stored in any directory listed in | ||
your `$fpath` variable. To use these completions, you must either | ||
add the generated script to one of those directories, or add your | ||
own to this list. | ||
Adding a custom directory is often the safest bet if you are | ||
unsure of which directory to use. First create the directory; for | ||
this example we'll create a hidden directory inside our `$HOME` | ||
directory: | ||
$ mkdir ~/.zfunc | ||
Then add the following lines to your `.zshrc` just before | ||
`compinit`: | ||
fpath+=~/.zfunc | ||
Now you can install the completions script using the following | ||
command: | ||
$ rustup completions zsh > ~/.zfunc/_rustup | ||
You must then either log out and log back in, or simply run | ||
$ exec zsh | ||
for the new completions to take effect. | ||
CUSTOM LOCATIONS: | ||
Alternatively, you could save these files to the place of your | ||
choosing, such as a custom directory inside your $HOME. Doing so | ||
will require you to add the proper directives, such as `source`ing | ||
inside your login script. Consult your shells documentation for | ||
how to add such directives. | ||
POWERSHELL: | ||
The powershell completion scripts require PowerShell v5.0+ (which | ||
comes with Windows 10, but can be downloaded separately for windows 7 | ||
or 8.1). | ||
First, check if a profile has already been set | ||
PS C:/> Test-Path $profile | ||
If the above command returns `False` run the following | ||
PS C:/> New-Item -path $profile -type file -force | ||
Now open the file provided by `$profile` (if you used the | ||
`New-Item` command it will be | ||
`${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1` | ||
Next, we either save the completions file into our profile, or | ||
into a separate file and source it inside our profile. To save the | ||
completions into our profile simply use | ||
PS C:/> rustup completions powershell >> | ||
${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 | ||
CARGO: | ||
Rustup can also generate a completion script for `cargo`. The script output | ||
by `rustup` will source the completion script distributed with your default | ||
toolchain. Not all shells are currently supported. Here are examples for | ||
the currently supported shells. | ||
BASH: | ||
$ rustup completions bash cargo >> ~/.local/share/bash-completion/completions/cargo | ||
ZSH: | ||
$ rustup completions zsh cargo > ~/.zfunc/_cargo | ||
""" | ||
stderr = "" |
21 changes: 21 additions & 0 deletions
21
tests/cli-ui/rustup_component_cmd_add_cmd_help_flag_stdout.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bin.name = "rustup" | ||
args = ["component","add","--help"] | ||
stdout = """ | ||
rustup-component-add | ||
Add a component to a Rust toolchain | ||
USAGE: | ||
rustup component add [OPTIONS] <component>... | ||
FLAGS: | ||
-h, --help Prints help information | ||
OPTIONS: | ||
--target <target> | ||
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see | ||
`rustup help toolchain` | ||
ARGS: | ||
<component>... | ||
""" | ||
stderr = "" |
18 changes: 18 additions & 0 deletions
18
tests/cli-ui/rustup_component_cmd_list_cmd_help_flag_stdout.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
bin.name = "rustup" | ||
args = ["component","list","--help"] | ||
stdout = """ | ||
rustup-component-list | ||
List installed and available components | ||
USAGE: | ||
rustup component list [FLAGS] [OPTIONS] | ||
FLAGS: | ||
-h, --help Prints help information | ||
--installed List only installed components | ||
OPTIONS: | ||
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see | ||
`rustup help toolchain` | ||
""" | ||
stderr = "" |
21 changes: 21 additions & 0 deletions
21
tests/cli-ui/rustup_component_cmd_remove_cmd_help_flag_stdout.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bin.name = "rustup" | ||
args = ["component","remove","--help"] | ||
stdout = """ | ||
rustup-component-remove | ||
Remove a component from a Rust toolchain | ||
USAGE: | ||
rustup component remove [OPTIONS] <component>... | ||
FLAGS: | ||
-h, --help Prints help information | ||
OPTIONS: | ||
--target <target> | ||
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see | ||
`rustup help toolchain` | ||
ARGS: | ||
<component>... | ||
""" | ||
stderr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bin.name = "rustup" | ||
args = ["default","--help"] | ||
stdout = """ | ||
rustup-default | ||
Set the default toolchain | ||
USAGE: | ||
rustup default [toolchain] | ||
FLAGS: | ||
-h, --help Prints help information | ||
ARGS: | ||
<toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help | ||
toolchain` | ||
DISCUSSION: | ||
Sets the default toolchain to the one specified. If the toolchain | ||
is not already installed then it is installed first. | ||
""" | ||
stderr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
bin.name = "rustup" | ||
args = ["doc","--help"] | ||
stdout = """ | ||
rustup-doc | ||
Open the documentation for the current toolchain | ||
USAGE: | ||
rustup doc [FLAGS] [OPTIONS] [topic] | ||
FLAGS: | ||
--alloc The Rust core allocation and collections library | ||
--book The Rust Programming Language book | ||
--cargo The Cargo Book | ||
--core The Rust Core Library | ||
--edition-guide The Rust Edition Guide | ||
--embedded-book The Embedded Rust Book | ||
-h, --help Prints help information | ||
--nomicon The Dark Arts of Advanced and Unsafe Rust Programming | ||
--path Only print the path to the documentation | ||
--proc_macro A support library for macro authors when defining new macros | ||
--reference The Rust Reference | ||
--rust-by-example A collection of runnable examples that illustrate various Rust concepts and standard | ||
libraries | ||
--rustc The compiler for the Rust programming language | ||
--rustdoc Documentation generator for Rust projects | ||
--std Standard library API documentation | ||
--test Support code for rustc's built in unit-test and micro-benchmarking framework | ||
--unstable-book The Unstable Book | ||
OPTIONS: | ||
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see | ||
`rustup help toolchain` | ||
ARGS: | ||
<topic> Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', | ||
'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc... | ||
DISCUSSION: | ||
Opens the documentation for the currently active toolchain with | ||
the default browser. | ||
By default, it opens the documentation index. Use the various | ||
flags to open specific pieces of documentation. | ||
""" | ||
stderr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
bin.name = "rustup" | ||
args = ["help"] | ||
status.code = 0 | ||
stdout = """ | ||
rustup [..] | ||
The Rust toolchain installer | ||
USAGE: | ||
rustup [FLAGS] [+toolchain] <SUBCOMMAND> | ||
FLAGS: | ||
-v, --verbose Enable verbose output | ||
-q, --quiet Disable progress output | ||
-h, --help Prints help information | ||
-V, --version Prints version information | ||
ARGS: | ||
<+toolchain> release channel (e.g. +stable) or custom toolchain to set override | ||
SUBCOMMANDS: | ||
show Show the active and installed toolchains or profiles | ||
update Update Rust toolchains and rustup | ||
check Check for updates to Rust toolchains and rustup | ||
default Set the default toolchain | ||
toolchain Modify or query the installed toolchains | ||
target Modify a toolchain's supported targets | ||
component Modify a toolchain's installed components | ||
override Modify directory toolchain overrides | ||
run Run a command with an environment configured for a given toolchain | ||
which Display which binary will be run for a given command | ||
doc Open the documentation for the current toolchain | ||
man View the man page for a given command | ||
self Modify the rustup installation | ||
set Alter rustup settings | ||
completions Generate tab-completion scripts for your shell | ||
help Prints this message or the help of the given subcommand(s) | ||
DISCUSSION: | ||
Rustup installs The Rust Programming Language from the official | ||
release channels, enabling you to easily switch between stable, | ||
beta, and nightly compilers and keep them updated. It makes | ||
cross-compiling simpler with binary builds of the standard library | ||
for common platforms. | ||
If you are new to Rust consider running `rustup doc --book` to | ||
learn Rust. | ||
""" | ||
stderr = "" |
Oops, something went wrong.