default to current name and confirm override
This commit is contained in:
parent
cbc818bd03
commit
c415ffbdab
40
src/main.rs
40
src/main.rs
@ -581,8 +581,24 @@ fn interactive() -> AResult<()>{
|
|||||||
std::io::Write::flush(&mut std::io::stdout())?;
|
std::io::Write::flush(&mut std::io::stdout())?;
|
||||||
let mut input_string=String::new();
|
let mut input_string=String::new();
|
||||||
std::io::stdin().read_line(&mut input_string)?;
|
std::io::stdin().read_line(&mut input_string)?;
|
||||||
if model_name_pattern.is_match(input_string.trim()){
|
let input_final=match input_string.trim(){
|
||||||
new_model_name=input_string.trim().to_owned();
|
""=>modelname.as_str(),
|
||||||
|
other=>other,
|
||||||
|
};
|
||||||
|
if model_name_pattern.is_match(input_final)
|
||||||
|
||{
|
||||||
|
//If you entered a new model name and it still doesn't like it, allow override
|
||||||
|
println!("Final model name: {}",input_final);
|
||||||
|
print!("Are you sure you want this model name? [y/N]:");
|
||||||
|
std::io::Write::flush(&mut std::io::stdout())?;
|
||||||
|
let mut input_string=String::new();
|
||||||
|
std::io::stdin().read_line(&mut input_string)?;
|
||||||
|
match input_string.trim(){
|
||||||
|
"y"=>true,
|
||||||
|
_=>false,
|
||||||
|
}
|
||||||
|
}{
|
||||||
|
new_model_name=input_final.to_owned();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -599,8 +615,24 @@ fn interactive() -> AResult<()>{
|
|||||||
std::io::Write::flush(&mut std::io::stdout())?;
|
std::io::Write::flush(&mut std::io::stdout())?;
|
||||||
let mut input_string=String::new();
|
let mut input_string=String::new();
|
||||||
std::io::stdin().read_line(&mut input_string)?;
|
std::io::stdin().read_line(&mut input_string)?;
|
||||||
if is_title_case(input_string.trim()){
|
let input_final=match input_string.trim(){
|
||||||
new_display_name=input_string.trim().to_owned();
|
""=>displayname.as_str(),
|
||||||
|
other=>other,
|
||||||
|
};
|
||||||
|
if is_title_case(input_string.trim())
|
||||||
|
||{
|
||||||
|
//If you entered a new display name and it still doesn't like it, allow override
|
||||||
|
println!("Final display name: {}",input_final);
|
||||||
|
print!("Are you sure you want this display name? [y/N]:");
|
||||||
|
std::io::Write::flush(&mut std::io::stdout())?;
|
||||||
|
let mut input_string=String::new();
|
||||||
|
std::io::stdin().read_line(&mut input_string)?;
|
||||||
|
match input_string.trim(){
|
||||||
|
"y"=>true,
|
||||||
|
_=>false,
|
||||||
|
}
|
||||||
|
}{
|
||||||
|
new_display_name=input_final.to_owned();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user