Add service and file arguments
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
41b272b704
commit
bcd3861fe0
1 changed files with 6 additions and 4 deletions
10
src/main.rs
10
src/main.rs
|
@ -14,12 +14,14 @@ async fn main() -> Result<(), Option<()>> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let args: Vec<String> = args().collect();
|
let args: Vec<String> = args().collect();
|
||||||
if args.len() != 3 {
|
if args.len() != 5 {
|
||||||
println!("Usage: {} <jid> <password>", args[0]);
|
println!("Usage: {} <jid> <password> <upload-service> <file>", args[0]);
|
||||||
return Err(None);
|
return Err(None);
|
||||||
}
|
}
|
||||||
let jid = &args[1];
|
let jid = &args[1];
|
||||||
let password = &args[2];
|
let password = &args[2];
|
||||||
|
let service = &args[3];
|
||||||
|
let file = Path::new(&args[4]);
|
||||||
|
|
||||||
// Client instance
|
// Client instance
|
||||||
let mut client = ClientBuilder::new(jid, password)
|
let mut client = ClientBuilder::new(jid, password)
|
||||||
|
@ -35,8 +37,8 @@ async fn main() -> Result<(), Option<()>> {
|
||||||
Event::Online => {
|
Event::Online => {
|
||||||
println!("Online.");
|
println!("Online.");
|
||||||
client.upload_file_with(
|
client.upload_file_with(
|
||||||
"share.serv.ice"
|
service,
|
||||||
Path::new("/some/file/path"),
|
file,
|
||||||
).await;
|
).await;
|
||||||
}
|
}
|
||||||
Event::HTTPUploadedFile(url) => {
|
Event::HTTPUploadedFile(url) => {
|
||||||
|
|
Loading…
Reference in a new issue