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();
|
||||
|
||||
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) => {
|
||||
|
|
Loading…
Reference in a new issue