]>
git.proxmox.com Git - rustc.git/blob - src/vendor/docopt/examples/cargo.rs
1 extern crate rustc_serialize
;
6 // Write the Docopt usage string.
7 const USAGE
: &'
static str = "
11 cargo <command> [<args>...]
15 -h, --help Display this message
16 -V, --version Print version info and exit
17 --list List installed commands
18 -v, --verbose Use verbose output
20 Some common cargo commands are:
21 build Compile the current project
22 clean Remove the target directory
23 doc Build this project's and its dependencies' documentation
24 new Create a new cargo project
25 run Build and execute src/main.rs
27 bench Run the benchmarks
28 update Update dependencies listed in Cargo.lock
30 See 'cargo help <command>' for more information on a specific command.
33 #[derive(Debug, RustcDecodable)]
35 arg_command
: Option
<Command
>,
36 arg_args
: Vec
<String
>,
41 #[derive(Debug, RustcDecodable)]
43 Build
, Clean
, Doc
, New
, Run
, Test
, Bench
, Update
,
47 let args
: Args
= Docopt
::new(USAGE
)
48 .and_then(|d
| d
.options_first(true).decode())
49 .unwrap_or_else(|e
| e
.exit());
50 println
!("{:?}", args
);