From 81e4a201bdcbc2744b70550fea94033681dcd547 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 15 Sep 2023 17:10:33 -0700 Subject: [PATCH] add delete to interactive upload --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index 810085e..acf0bad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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::(){ 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(())