5 /// The directory documentation output was generated in
7 /// The file documentation was generated for, with docck commands to check
11 /// Create a Config from a vector of command-line arguments
12 pub fn parse_config(args: Vec<String>) -> Config {
13 let mut opts = Options::new();
14 opts.reqopt("", "doc-dir", "Path to the documentation directory", "PATH")
15 .reqopt("", "template", "Path to the template file", "PATH")
16 .optflag("h", "help", "show this message");
18 let (argv0, args_) = args.split_first().unwrap();
20 let message = format!("Usage: {} <doc-dir> <template>", argv0);
21 println!("{}", opts.usage(&message));
22 std::process::exit(1);
25 let matches = opts.parse(args_).unwrap();
27 if matches.opt_present("h") || matches.opt_present("help") {
28 let message = format!("Usage: {} <doc-dir> <template>", argv0);
29 println!("{}", opts.usage(&message));
30 std::process::exit(1);
34 doc_dir: matches.opt_str("doc-dir").unwrap(),
35 template: matches.opt_str("template").unwrap(),