diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-11-06 17:18:31 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-11-06 17:18:31 +0100 |
commit | 203de7061c04ae8fbe2b57e755da00c2f66a5a97 (patch) | |
tree | d2f22e4177dddb2a717b1608f5cde9a257c893a4 /examples/zotcli.rs | |
parent | 3e627a2e38d296b919e0b4439f2a93b0fb1d5e21 (diff) | |
download | rust-zotapi-203de7061c04ae8fbe2b57e755da00c2f66a5a97.tar.gz rust-zotapi-203de7061c04ae8fbe2b57e755da00c2f66a5a97.tar.bz2 rust-zotapi-203de7061c04ae8fbe2b57e755da00c2f66a5a97.zip |
Move the post new item example code to new example app.
Diffstat (limited to 'examples/zotcli.rs')
-rw-r--r-- | examples/zotcli.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/zotcli.rs b/examples/zotcli.rs index 6b3a97b..c3cfc8b 100644 --- a/examples/zotcli.rs +++ b/examples/zotcli.rs @@ -77,6 +77,12 @@ fn main() { .arg(Arg::with_name("ID") .help("id (email, hash or GUID) of xchan to fetch") .required(true))) + .subcommand( + SubCommand::with_name("post") + .about("Post a new message") + .arg(Arg::with_name("BODY") + .help("body of message") + .required(true))) .get_matches(); let client = zotapi::client(&site, &user, &password); @@ -108,6 +114,10 @@ fn main() { zot::xchan::fetch(&client, raw, t, m.value_of("ID").unwrap()); }, + ("post", Some(m)) => { + let body = m.value_of("BODY").unwrap(); + zot::item::post(&client, body); + }, _ => { println!("{}", matches.usage()); }, |