use clap::ArgMatches; use std::fs; use std::io; pub fn new_gist(matches: &ArgMatches) -> io::Result<()> { let title = matches.value_of("title").unwrap(); let input = matches.value_of("input"); let mut rdr: Box = match input { Some(file) => Box::new(fs::File::open(file)?), None => Box::new(io::stdin()), }; let mut body = String::new(); rdr.read_to_string(&mut body)?; println!("title: {}", title); println!("body: {}", body); Ok(()) }