Skip to content

Commit

Permalink
Merge pull request #418 from rust-lang-nursery/term-md
Browse files Browse the repository at this point in the history
Improvements to welcome screen
  • Loading branch information
Diggsey committed May 8, 2016
2 parents a4ad83f + 48635fb commit 0de142a
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 167 deletions.
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 @@ -300,10 +303,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 @@ -326,9 +329,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

0 comments on commit 0de142a

Please sign in to comment.