Add service and file arguments

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-12-27 01:11:44 +01:00
parent 41b272b704
commit bcd3861fe0
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -14,12 +14,14 @@ async fn main() -> Result<(), Option<()>> {
env_logger::init();
let args: Vec<String> = args().collect();
if args.len() != 3 {
println!("Usage: {} <jid> <password>", args[0]);
if args.len() != 5 {
println!("Usage: {} <jid> <password> <upload-service> <file>", 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) => {