blob: 6dbd97fc42af1afd7f18b7d277a500694c502e7c [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
Chih-Hung Hsieha7d348c2020-11-01 19:38:56 -080022 Opt::clap().gen_completions("structopt", Shell::Bash, "target");
Matthew Maurer32e76692020-06-02 11:15:15 -070023
24 let opt = Opt::from_args();
25 println!("{:?}", opt);
26}