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.4KB

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