forked from StrafesNET/map-tool
condense prompt logic
This commit is contained in:
parent
9685301b30
commit
ef5703f282
16
src/main.rs
16
src/main.rs
@ -430,18 +430,16 @@ fn upload() -> AResult<()>{
|
||||
//Creator: [auto fill creator]
|
||||
//DisplayName: [auto fill DisplayName]
|
||||
//id: ["New" for blank because of my double enter key]
|
||||
print!("Model name: {}\nCreator: {}\nDisplayName: {}\nAction or Upload Asset Id: ",modelname,creator,displayname);
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
print!("Model name: {}\nCreator: {}\nDisplayName: {}\n",modelname,creator,displayname);
|
||||
let upload_action;
|
||||
loop{
|
||||
print!("Action or Upload Asset Id: ");
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
let mut upload_action_string = String::new();
|
||||
std::io::stdin().read_line(&mut upload_action_string)?;
|
||||
if let Ok(parsed_upload_action)=upload_action_string.parse::<UploadAction>(){
|
||||
upload_action=parsed_upload_action;
|
||||
break;
|
||||
}else{
|
||||
print!("Action or Upload Asset Id: ");
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
}
|
||||
}
|
||||
match upload_action {
|
||||
@ -569,22 +567,20 @@ fn interactive() -> AResult<()>{
|
||||
ScriptAction::Replace(*replace_id)
|
||||
}else{
|
||||
//interactive logic goes here
|
||||
print!("unresolved source location={}\naction: ",get_full_name(&dom, script));
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
print!("unresolved source location={}\n",get_full_name(&dom, script));
|
||||
//load source into current.lua
|
||||
std::fs::write("current.lua",source)?;
|
||||
//prompt action in terminal
|
||||
//wait for input
|
||||
let script_action;
|
||||
loop{
|
||||
print!("action: ");
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
let mut action_string = String::new();
|
||||
std::io::stdin().read_line(&mut action_string)?;
|
||||
if let Ok(parsed_script_action)=action_string.parse::<ScriptActionParseResult>(){
|
||||
script_action=parsed_script_action;
|
||||
break;
|
||||
}else{
|
||||
print!("action: ");
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
}
|
||||
}
|
||||
//update allowed/replace/blocked
|
||||
|
Loading…
Reference in New Issue
Block a user