blob: 4f35b075fa72654326d1327b27137516e8137902 [file] [log] [blame]
Matthew Maurer32e76692020-06-02 11:15:15 -07001// Copyright 2019-present structopt developers
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
9use structopt::clap::Shell;
10use structopt::StructOpt;
11
12#[derive(StructOpt, Debug)]
13/// An example of how to generate bash completions with structopt.
14struct Opt {
15 #[structopt(short, long)]
16 /// Activate debug mode
17 debug: bool,
18}
19
20fn main() {
21 // generate `bash` completions in "target" directory
22 Opt::clap().gen_completions(env!("CARGO_PKG_NAME"), Shell::Bash, "target");
23
24 let opt = Opt::from_args();
25 println!("{:?}", opt);
26}