aboutsummaryrefslogtreecommitdiffstats
path: root/examples/zotcli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/zotcli.rs')
-rw-r--r--examples/zotcli.rs10
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());
},