11# auto-generate completions
22
3- - basic helpers to parse --help information from cli commands and export nu completions source
4- - basic helpers tp parse .fish complete files and export nu completions source
3+ - basic helpers to parse ` --help ` information from cli commands and export nu completions source
4+ - basic helpers to parse ` .fish ` complete files and export nu completions source
55
6- # parse-fish
6+ ## parse-fish
7+
8+ ### current
79
8- ## current
910- only parses out simple complete's with no complete's boolean arguments like -f
1011- does not map fish autocomplete helpers to nu-complete helps (a nu library of autocomplete utils would be neat)
1112
12- ## usage
13+ ### usage
1314
14- be in a directory with one or more .fish completion scripts
15+ be in a directory with one or more ` .fish ` completion scripts
1516
16- A good one is
17+ A good one is
1718
18- ` git clone https://github.com/fish-shell/fish-shell `
19- ` cd fish-shell/share/completions `
19+ ``` nushell
20+ git clone https://github.com/fish-shell/fish-shell
21+ cd fish-shell/share/completions
22+ ```
2023
21- To build all .fish files in the current directory ` build-completions-from-pwd `
24+ To build all ` .fish ` files in the current directory ` build-completions-from-pwd `
2225
23- ``` nu
26+ ``` nushell
2427build-completions-from-pwd
2528ls *.nu
2629```
2730
28- To build a single .fish file and choose the output file
29- ``` nu
31+ To build a single ` .fish ` file and choose the output file
32+
33+ ``` nushell
3034build-completion cargo.fish cargo.nu
3135```
32- # parse-help
3336
34- ## current limitations
37+ ## parse-help
38+
39+ ### current limitations
3540
36- - Only flags are parsed, arguments are not parsed and ...args is injected at the end to catch all
41+ - Only flags are parsed, arguments are not parsed and ` ...args ` is injected at the end to catch all
3742- Some examples of ` --flags ` in descriptions can throw off the regex and get included in the parsed flags
3843- ` <format> ` (types) to flags are parsed, but not added to the nu shell completion type hints
3944
40- ## usage
45+ ### usage
4146
4247generate and save source to a file
4348
44- ``` nu
49+ ``` nushell
4550source parse-help.nu
4651cargo --help | parse-help | make-completion cargo | save cargo.nu
4752```
4853
49- ## example
54+ ### example
5055
5156This can be saved to a file and sourced. Example of output
5257
53- ``` nu
58+ ``` nushell
5459extern "cargo" [
5560 --version(-V) #Print version info and exit
5661 --list #List installed commands
@@ -84,7 +89,8 @@ extern "nu" [
8489```
8590
8691Which outputs like so on tab completion for ` cargo -- `
87- ```
92+
93+ ``` nushell
8894❯ | cargo --
8995--color Coloring: auto, always, never
9096--config Override a configuration value (unstable)
@@ -98,4 +104,4 @@ Which outputs like so on tab completion for `cargo --`
98104--quiet Do not print cargo log messages
99105--verbose Use verbose output (-vv very verbose/build.rs output)
100106--version Print version info and exit
101- ```
107+ ```
0 commit comments