diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-06-03 14:36:23 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-06-17 12:04:24 +0200 |
commit | 56fcb569fd2f064f723ed091b6c2b0be1041288b (patch) | |
tree | 31cea0b7b21c5a1438b296f107efadce0b6dfe7b /ipc/examples | |
parent | 05f298df6f99e1c1cf485594b7eda264e4e2f403 (diff) |
ipc: Add Assuan support.
Diffstat (limited to 'ipc/examples')
-rw-r--r-- | ipc/examples/assuan-client.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ipc/examples/assuan-client.rs b/ipc/examples/assuan-client.rs new file mode 100644 index 00000000..5b0b3e14 --- /dev/null +++ b/ipc/examples/assuan-client.rs @@ -0,0 +1,29 @@ +extern crate futures; +use futures::future::Future; +extern crate clap; +extern crate sequoia_ipc as ipc; +use 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); + let responses = c.send(command).wait().unwrap(); + for response in responses { + eprintln!("< {:?}", response); + } + } +} |