The CLI frontend to a gist server written in Rust
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021
  1. use clap::ArgMatches;
  2. use std::fs;
  3. use std::io;
  4. pub fn new_gist(matches: &ArgMatches) -> io::Result<()> {
  5. let title = matches.value_of("title").unwrap();
  6. let input = matches.value_of("input");
  7. let mut rdr: Box<io::Read> = match input {
  8. Some(file) => Box::new(fs::File::open(file)?),
  9. None => Box::new(io::stdin()),
  10. };
  11. let mut body = String::new();
  12. rdr.read_to_string(&mut body)?;
  13. println!("title: {}", title);
  14. println!("body: {}", body);
  15. Ok(())
  16. }