forked from StrafesNET/map-tool
add delete to interactive upload
This commit is contained in:
parent
8fd5618af2
commit
81e4a201bd
@ -352,6 +352,7 @@ enum UploadAction {
|
||||
Upload(u64),
|
||||
Skip,
|
||||
New,
|
||||
Delete,
|
||||
}
|
||||
struct ParseUploadActionErr;
|
||||
impl std::str::FromStr for UploadAction {
|
||||
@ -361,6 +362,8 @@ impl std::str::FromStr for UploadAction {
|
||||
Ok(Self::Skip)
|
||||
}else if s=="new\n"{
|
||||
Ok(Self::New)
|
||||
}else if s=="delete\n"{
|
||||
Ok(Self::Delete)
|
||||
}else if let Ok(asset_id)=s[..s.len()-1].parse::<u64>(){
|
||||
Ok(Self::Upload(asset_id))
|
||||
}else{
|
||||
@ -435,6 +438,7 @@ fn upload() -> BoxResult<()>{
|
||||
None => println!("no status code!"),
|
||||
}
|
||||
}
|
||||
UploadAction::Delete => std::fs::remove_file(file_thing.path())?,
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user