You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c2d1527
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/index.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,17 +92,17 @@ follow the OS-specific instructions below.
92
92
93
93
## FAQs
94
94
95
-
Not working?
96
-
97
95
- Ensure that `shtab` and the application you're trying to complete are both accessible from your environment.
98
-
- Ensure that `prog` is set:
99
-
- if using [`options.entry_points.console_scripts=MY_PROG=...`](https://setuptools.pypa.io/en/latest/userguide/entry_point.html), then ensure the main parser's `prog` matches `argparse.ArgumentParser(prog="MY_PROG")` or override it using `shtab MY_PROG.get_main_parser --prog=MY_PROG`.
100
-
- if executing a script file `./MY_PROG.py` (with a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>)`#!/usr/bin/env python`) directly, then use `argparse.ArgumentParser(prog="MY_PROG.py")` or override it using `shtab MY_PROG.get_main_parser --prog=MY_PROG.py`.
101
-
- Any argument with `help=argparse.SUPPRESS` is skipped.
96
+
- Ensure that `prog` matches the executable name:
97
+
- if using [`project.scripts.MY-PROG=...`](https://setuptools.pypa.io/en/latest/userguide/entry_point.html), then
98
+
- set the main parser's name (`argparse.ArgumentParser(prog="MY-PROG")`, `argopt(prog="MY-PROG")`, `click.group("MY-PROG")`, `click.command("MY-PROG")`, etc)
99
+
- or override it using `shtab MY_PROG.get_main_parser --prog=MY-PROG`
100
+
- if executing a script file `./MY_PROG.py` (with a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>)`#!/usr/bin/env python`) directly, then use `prog="MY_PROG.py"`
101
+
- Any suppressed argument (`help=argparse.SUPPRESS`, click `hidden=True`/`deprecated=True`) is skipped.
102
102
- Default completion (when no choices are specified) is disabled. Enable it explicitly via e.g. `parser.add_argument('positional').complete = shtab.FILE`.
103
103
- Some shells (e.g. `zsh`, `fish`) print information during tab completion:
104
-
- subparser `description` takes precedence over `help`.
105
-
- argument `metavar` takes precedence over `dest`.
104
+
- subparser `description` takes precedence over `help`
105
+
- argument `metavar` takes precedence over `dest`
106
106
-[Ask a general question on StackOverflow](https://stackoverflow.com/questions/tagged/shtab).
107
107
-[Report bugs and open feature requests on GitHub][issues].
| sudo tee /usr/share/fish/vendor_completions.d/MY-PROG.fish
154
156
```
155
157
156
158
### click
157
159
158
-
Speedup `click`'s completions (and get support for more shell types) by changing from e.g. `_MY_PROG_COMPLETE=bash_source my-prog` to `shtab my_prog.cli.cli --prog my-prog -s bash`
160
+
Speedup `click`'s completions (and get support for more shell types) by changing from e.g. `_MY_PROG_COMPLETE=bash_source MY-PROG` to `shtab MY_PROG.cli.main --prog MY-PROG -s bash`
159
161
160
162
## Library Usage
161
163
@@ -229,7 +231,7 @@ Add direct support to scripts for a little more configurability:
0 commit comments