Skip to content

Commit

Permalink
Merge pull request #35 from hey2022/fix/windows-newline
Browse files Browse the repository at this point in the history
fix: newline input on windows
  • Loading branch information
hey2022 authored Sep 14, 2024
2 parents 2472eea + c3c2de5 commit 5567994
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Config {

pub fn login() {
print!("Username: ");
let name = read!("{}\n");
let name = read!();
let password = rpassword::prompt_password("Password: ").unwrap();
let timestamp = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ fn select_semester(semesters: &[Semester]) -> Semester {
}
}
print!("Choose a semester [{}]: ", current_semester);
let input: String = read!("{}\n");
let mut input: String = read!("{}\n");
input = input.trim().to_string();
if !input.is_empty() {
current_semester = input.parse().expect("Input not an integer");
}
Expand Down

0 comments on commit 5567994

Please sign in to comment.