blob: 6d790363b4dd47275534a8521ae7e5542feaae3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use futures;
use futures::future::Future;
use futures::stream::Stream;
use clap;
use sequoia_ipc as ipc;
use crate::ipc::assuan::Client;
fn main() {
let matches = clap::App::new("assuan-client")
.version(env!("CARGO_PKG_VERSION"))
.about("Connects to and sends commands to assuan servers.")
.arg(clap::Arg::with_name("server").value_name("PATH")
.required(true)
.help("Server to connect to"))
.arg(clap::Arg::with_name("commands").value_name("COMMAND")
.required(true)
.multiple(true)
.help("Commands to send to the server"))
.get_matches();
let mut c = Client::connect(matches.value_of("server").unwrap())
.wait().unwrap();
for command in matches.values_of("commands").unwrap() {
eprintln!("> {}", command);
c.send(command).unwrap();
c.by_ref().for_each(|response| {
eprintln!("< {:?}", response);
Ok(())
}).wait().unwrap();
}
}
|