cp/cp.rs
1use docopt::Docopt;
2use serde::Deserialize;
3
4// Write the Docopt usage string.
5const USAGE: &'static str = "
6Usage: cp [-a] <source> <dest>
7 cp [-a] <source>... <dir>
8
9Options:
10 -a, --archive Copy everything.
11";
12
13#[derive(Debug, Deserialize)]
14struct Args {
15 arg_source: Vec<String>,
16 arg_dest: String,
17 arg_dir: String,
18 flag_archive: bool,
19}
20
21fn main() {
22 let args: Args = Docopt::new(USAGE)
23 .and_then(|d| d.deserialize())
24 .unwrap_or_else(|e| e.exit());
25 println!("{:?}", args);
26}