add delete to interactive upload

This commit is contained in:
Quaternions 2023-09-15 17:10:33 -07:00
parent 8fd5618af2
commit 81e4a201bd

View File

@ -352,6 +352,7 @@ enum UploadAction {
Upload(u64), Upload(u64),
Skip, Skip,
New, New,
Delete,
} }
struct ParseUploadActionErr; struct ParseUploadActionErr;
impl std::str::FromStr for UploadAction { impl std::str::FromStr for UploadAction {
@ -361,6 +362,8 @@ impl std::str::FromStr for UploadAction {
Ok(Self::Skip) Ok(Self::Skip)
}else if s=="new\n"{ }else if s=="new\n"{
Ok(Self::New) Ok(Self::New)
}else if s=="delete\n"{
Ok(Self::Delete)
}else if let Ok(asset_id)=s[..s.len()-1].parse::<u64>(){ }else if let Ok(asset_id)=s[..s.len()-1].parse::<u64>(){
Ok(Self::Upload(asset_id)) Ok(Self::Upload(asset_id))
}else{ }else{
@ -435,6 +438,7 @@ fn upload() -> BoxResult<()>{
None => println!("no status code!"), None => println!("no status code!"),
} }
} }
UploadAction::Delete => std::fs::remove_file(file_thing.path())?,
} }
} }
Ok(()) Ok(())