extern crate chrono; extern crate clap; extern crate reqwest; extern crate serde; extern crate serde_json; use clap::{App, Arg, SubCommand}; use std::io; mod cli; mod client; fn main() -> io::Result<()> { let matches = App::new("gist") .version("0.0.1") .subcommand( SubCommand::with_name("new") .about("Creates a new gist") .arg( Arg::with_name("name") .long("name") .short("n") .takes_value(true) .required(true) .help("The name of the gist"), ) .arg( Arg::with_name("file") .long("file") .short("file") .takes_value(true) .help("The file to use as the body of the gist"), ) .arg( Arg::with_name("filetype") .long("filetype") .short("t") .takes_value(true) .default_value("") .help("The filetype to use for syntax highlighting"), ) .arg( Arg::with_name("hostname") .long("hostname") .short("s") .takes_value(true) .default_value("bngl.ws") .help("The hostname of the server to post your gist to"), ) .arg( Arg::with_name("protocol") .long("protocol") .short("c") .takes_value(true) .possible_values(&["http", "https"]) .default_value("https") .help("The transport protocol to use"), ) .arg( Arg::with_name("port") .long("port") .short("p") .takes_value(true) .default_value("80") .help("The transport protocol to use"), ), ) .get_matches(); if let Some(matches) = matches.subcommand_matches("new") { cli::new_gist(&matches)?; } Ok(()) }