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