The CLI frontend to a gist server written in Rust
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.rs 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. extern crate clap;
  2. extern crate reqwest;
  3. extern crate serde;
  4. extern crate serde_json;
  5. use clap::{App, Arg, SubCommand};
  6. use std::io;
  7. mod cli;
  8. mod client;
  9. fn main() -> io::Result<()> {
  10. let matches = App::new("gist")
  11. .version("0.0.1")
  12. .subcommand(
  13. SubCommand::with_name("new")
  14. .about("Creates a new gist")
  15. .arg(
  16. Arg::with_name("title")
  17. .long("title")
  18. .short("t")
  19. .takes_value(true)
  20. .required(true)
  21. .help("The title of the gist"),
  22. )
  23. .arg(
  24. Arg::with_name("file")
  25. .long("file")
  26. .short("file")
  27. .takes_value(true)
  28. .help("The file to use as the body of the gist"),
  29. ),
  30. )
  31. .get_matches();
  32. if let Some(matches) = matches.subcommand_matches("new") {
  33. cli::new_gist(&matches)?;
  34. }
  35. Ok(())
  36. }