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

Improvements to welcome screen #418

Merged
merged 4 commits into from
May 8, 2016
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
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ rand = "0.3.11"
scopeguard = "0.1.2"
rustc-serialize = "0.3"
sha2 = "0.1.2"
markdown = { git="https://github.com/Diggsey/markdown.rs.git" }

[target."cfg(windows)".dependencies]
winapi = "0.2.4"
Expand Down
29 changes: 16 additions & 13 deletions src/rustup-cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ pub enum Confirm {
Yes, No, Advanced
}

pub fn confirm_advanced(default: Confirm) -> Result<Confirm> {
pub fn confirm_advanced() -> Result<Confirm> {
println!("");
println!("1) Proceed with installation (default)");
println!("2) Customize installation");
println!("3) Cancel installation");

let _ = std::io::stdout().flush();
let input = try!(read_line());

let r = match &*input {
"y" | "Y" | "yes" => Confirm::Yes,
"n" | "N" | "no" => Confirm::No,
"a" | "A" | "advanced" => Confirm::Advanced,
"" => default,
"1"|"" => Confirm::Yes,
"2" => Confirm::Advanced,
_ => Confirm::No,
};

Expand Down Expand Up @@ -99,7 +102,7 @@ pub fn set_globals(verbose: bool) -> Result<Cfg> {

let download_tracker = RefCell::new(DownloadTracker::new());

Ok(try!(Cfg::from_env(shared_ntfy!(move |n: Notification| {
Ok(try!(Cfg::from_env(shared_ntfy!(move |n: Notification| {
if download_tracker.borrow_mut().handle_notification(&n) {
return;
}
Expand Down Expand Up @@ -302,10 +305,10 @@ pub fn list_toolchains(cfg: &Cfg) -> Result<()> {
} else {
if let Ok(Some(def_toolchain)) = cfg.find_default() {
for toolchain in toolchains {
let if_default = if def_toolchain.name() == &*toolchain {
" (default)"
} else {
""
let if_default = if def_toolchain.name() == &*toolchain {
" (default)"
} else {
""
};
println!("{}{}", &toolchain, if_default);
}
Expand All @@ -328,9 +331,9 @@ pub fn list_overrides(cfg: &Cfg) -> Result<()> {
println!("no overrides");
} else {
for o in overrides {
split_override::<String>(&o, ';').map(|li|
println!("{:<40}\t{:<20}",
utils::format_path_for_display(&li.0),
split_override::<String>(&o, ';').map(|li|
println!("{:<40}\t{:<20}",
utils::format_path_for_display(&li.0),
li.1)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/rustup-cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern crate rand;
extern crate scopeguard;
extern crate tempdir;
extern crate sha2;
extern crate markdown;

#[cfg(windows)]
extern crate winapi;
Expand Down Expand Up @@ -169,4 +170,3 @@ fn fix_windows_reg_key() {

#[cfg(not(windows))]
fn fix_windows_reg_key() { }

Loading