1 // Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>
2 //
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6 // option. This file may not be copied, modified, or distributed
7 // except according to those terms.
8 
9 // This should be in tests but it will not work until
10 // https://github.com/rust-lang/rust/issues/24584 is fixed
11 
12 //! A test to check that structopt compiles with deny(missing_docs)
13 
14 #![deny(missing_docs)]
15 
16 use structopt::StructOpt;
17 
18 /// The options
19 #[derive(StructOpt, Debug, PartialEq)]
20 pub struct Opt {
21     #[structopt(short)]
22     verbose: bool,
23     #[structopt(subcommand)]
24     cmd: Option<Cmd>,
25 }
26 
27 /// Some subcommands
28 #[derive(StructOpt, Debug, PartialEq)]
29 pub enum Cmd {
30     /// command A
31     A,
32     /// command B
33     B {
34         /// Alice?
35         #[structopt(short)]
36         alice: bool,
37     },
38     /// command C
39     C(COpt),
40 }
41 
42 /// The options for C
43 #[derive(StructOpt, Debug, PartialEq)]
44 pub struct COpt {
45     #[structopt(short)]
46     bob: bool,
47 }
48 
main()49 fn main() {
50     println!("{:?}", Opt::from_args());
51 }
52