diff options
Diffstat (limited to 'examples/zot.rs')
-rw-r--r-- | examples/zot.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/zot.rs b/examples/zot.rs index a0d930e..2c49fe3 100644 --- a/examples/zot.rs +++ b/examples/zot.rs @@ -26,6 +26,7 @@ use dotenv::dotenv; use std::env; mod channel_stream; +mod network_stream; fn main() { dotenv().ok(); @@ -40,12 +41,24 @@ fn main() { .arg(Arg::with_name("raw") .long("raw") .help("Display raw json payload"))) + .subcommand( + SubCommand::with_name("network-stream") + .about("Fetch the network stream") + .arg(Arg::with_name("raw") + .long("raw") + .help("Display raw json payload"))) .get_matches(); + let client = zotapi::client(&site, &user, &password); + match matches.subcommand() { ("channel-stream", Some(m)) => { let raw = m.is_present("raw"); - channel_stream::fetch(&zotapi::client(&site, &user, &password), raw); + channel_stream::fetch(&client, raw); + }, + ("network-stream", Some(m)) => { + let raw = m.is_present("raw"); + network_stream::fetch(&client, raw); }, _ => { println!("{}", matches.usage()); |