diff --git a/src/main.rs b/src/main.rs index 4b1d116..035d2d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -351,6 +351,7 @@ fn replace() -> BoxResult<()>{ enum UploadAction { Upload(u64), Skip, + New, } struct ParseUploadActionErr; impl std::str::FromStr for UploadAction { @@ -358,6 +359,8 @@ impl std::str::FromStr for UploadAction { fn from_str(s: &str) -> Result{ if s=="skip\n"{ Ok(Self::Skip) + }else if s=="new\n"{ + Ok(Self::New) }else{ if let Ok(asset_id)=s[..s.len()-1].parse::(){ Ok(Self::Upload(asset_id)) @@ -414,6 +417,26 @@ fn upload() -> BoxResult<()>{ } } UploadAction::Skip => continue, + UploadAction::New => { + let output=std::process::Command::new("../rbxcompiler-linux-amd64") + .arg("--compile=false") + .arg("--group=6980477") + .arg("--new-asset=true") + .arg(format!("--input={}",file_thing.path().into_os_string().into_string().unwrap())) + .output()?; + match output.status.code() { + Some(0)=>{ + //print output + println!("{}", std::str::from_utf8(output.stdout.as_slice())?); + //move file + let mut dest=std::path::PathBuf::from("maps/uploaded"); + dest.push(file_thing.file_name()); + std::fs::rename(file_thing.path(), dest)?; + } + Some(code)=>println!("upload failed! code={}",code), + None => println!("no status code!"), + } + } } } Ok(())