default to current name and confirm override

This commit is contained in:
Quaternions 2024-08-24 19:35:27 -07:00
parent cbc818bd03
commit c415ffbdab

View File

@ -581,8 +581,24 @@ fn interactive() -> AResult<()>{
std::io::Write::flush(&mut std::io::stdout())?;
let mut input_string=String::new();
std::io::stdin().read_line(&mut input_string)?;
if model_name_pattern.is_match(input_string.trim()){
new_model_name=input_string.trim().to_owned();
let input_final=match input_string.trim(){
""=>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;
}
}
@ -599,8 +615,24 @@ fn interactive() -> AResult<()>{
std::io::Write::flush(&mut std::io::stdout())?;
let mut input_string=String::new();
std::io::stdin().read_line(&mut input_string)?;
if is_title_case(input_string.trim()){
new_display_name=input_string.trim().to_owned();
let input_final=match input_string.trim(){
""=>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;
}
}