From bcd3861fe030cfd471e7e138bc39cb20bf8260ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 27 Dec 2021 01:11:44 +0100 Subject: [PATCH] Add service and file arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 55db490..7661715 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,12 +14,14 @@ async fn main() -> Result<(), Option<()>> { env_logger::init(); let args: Vec = args().collect(); - if args.len() != 3 { - println!("Usage: {} ", args[0]); + if args.len() != 5 { + println!("Usage: {} ", args[0]); return Err(None); } let jid = &args[1]; let password = &args[2]; + let service = &args[3]; + let file = Path::new(&args[4]); // Client instance let mut client = ClientBuilder::new(jid, password) @@ -35,8 +37,8 @@ async fn main() -> Result<(), Option<()>> { Event::Online => { println!("Online."); client.upload_file_with( - "share.serv.ice" - Path::new("/some/file/path"), + service, + file, ).await; } Event::HTTPUploadedFile(url) => {