Clap: How to generate completion scripts?

Created on 12 Jul 2018  Β·  3Comments  Β·  Source: clap-rs/clap

I am not seeing any where where the completion script is actually generated:

  • I donΒ΄t see the 'completions' feature that I have seen in some old issues
  • no completion seems to be generated when using --release

How does the generation of the completion scripts work ?

After building a simple sample using --release, I get the following:

$ tree
.
β”œβ”€β”€ Cargo.lock
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ README.adoc
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ cli.yml
β”‚   └── main.rs
└── target
    └── release
        β”œβ”€β”€ build
        β”œβ”€β”€ cli-args
        β”œβ”€β”€ cli-args.d
        β”œβ”€β”€ deps
        β”‚   β”œβ”€β”€ ansi_term-dc00aa8213642655.d
        β”‚   β”œβ”€β”€ atty-9fb9c107a1aae491.d
        β”‚   β”œβ”€β”€ bitflags-12d5ff0cd1d1e3c1.d
        β”‚   β”œβ”€β”€ clap-628f3835cbf1ff58.d
        β”‚   β”œβ”€β”€ cli_args-1ce89ace9d3ffa2f
        β”‚   β”œβ”€β”€ cli_args-1ce89ace9d3ffa2f.d
        β”‚   β”œβ”€β”€ libansi_term-dc00aa8213642655.rlib
        β”‚   β”œβ”€β”€ libatty-9fb9c107a1aae491.rlib
        β”‚   β”œβ”€β”€ libbitflags-12d5ff0cd1d1e3c1.rlib
        β”‚   β”œβ”€β”€ libc-015d13a8fc234244.d
        β”‚   β”œβ”€β”€ libclap-628f3835cbf1ff58.rlib
        β”‚   β”œβ”€β”€ liblibc-015d13a8fc234244.rlib
        β”‚   β”œβ”€β”€ libstrsim-173d696401437ef5.rlib
        β”‚   β”œβ”€β”€ libtextwrap-b669f98b21ed064a.rlib
        β”‚   β”œβ”€β”€ libunicode_width-fc1225c02239f755.rlib
        β”‚   β”œβ”€β”€ libyaml_rust-004b87347b1a132f.rlib
        β”‚   β”œβ”€β”€ strsim-173d696401437ef5.d
        β”‚   β”œβ”€β”€ textwrap-b669f98b21ed064a.d
        β”‚   β”œβ”€β”€ unicode_width-fc1225c02239f755.d
        β”‚   └── yaml_rust-004b87347b1a132f.d
        β”œβ”€β”€ examples
        β”œβ”€β”€ incremental
        └── native
docs examples generator easy nice to have 3.x mentored

Most helpful comment

I should probably add an example to examples dir that explains this. But the details can be found here:

https://docs.rs/clap/2.32.0/clap/struct.App.html#method.gen_completions

All 3 comments

I should probably add an example to examples dir that explains this. But the details can be found here:

https://docs.rs/clap/2.32.0/clap/struct.App.html#method.gen_completions

I'm going to close this for now, and mark as "after v3 release"

Thanks @kbknapp thatΒ΄s the link I was missing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smklein picture smklein  Β·  35Comments

kbknapp picture kbknapp  Β·  18Comments

joshtriplett picture joshtriplett  Β·  41Comments

kbknapp picture kbknapp  Β·  22Comments

kbknapp picture kbknapp  Β·  16Comments