File tree Expand file tree Collapse file tree 4 files changed +47
-12
lines changed
Expand file tree Collapse file tree 4 files changed +47
-12
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Welcome to **autohooks**!
1919- [ Requirements] ( #requirements )
2020- [ Plugins] ( #plugins )
2121- [ Installing autohooks] ( #installing-autohooks )
22+ - [ Command Completion] ( #command-completion )
2223- [ Maintainer] ( #maintainer )
2324- [ Contributing] ( #contributing )
2425- [ License] ( #license )
@@ -104,6 +105,33 @@ will use the [pythonpath mode](#pythonpath-mode) by default.
104105For more details on using [ pip] , [ poetry] or [ pipenv] in conjunction with these
105106modes see the [ documentation] ( https://greenbone.github.io/autohooks ) .
106107
108+ ## Command Completion
109+
110+ ` autohooks ` comes with support for command line completion in bash
111+ and zsh.
112+
113+ Setup for bash:
114+
115+ ``` bash
116+ echo " source ~/.autohooks-complete.bash" >> ~ /.bashrc
117+ autohooks --print-completion bash > ~ /.autohooks-complete.bash
118+ ```
119+
120+ Alternatively, you can use the result of the completion command directly with
121+ the eval function of your bash shell:
122+
123+ ``` bash
124+ eval " $( autohooks --print-completion bash) "
125+ ```
126+
127+ Setup for zsh:
128+
129+ ``` zsh
130+ echo ' fpath=("$HOME/.zsh.d" $fpath)' >> ~ /.zsh
131+ mkdir -p ~ /.zsh.d/
132+ autohooks --print-completion zsh > ~ /.zsh.d/_greenbone_feed_sync
133+ ```
134+
107135## Maintainer
108136
109137This project is maintained by [ Greenbone AG] ( https://www.greenbone.net/ ) .
Original file line number Diff line number Diff line change 66import argparse
77import sys
88
9+ import shtab
10+
911from autohooks .__version__ import __version__ as version
1012from autohooks .cli .activate import install_hooks
1113from autohooks .cli .check import check_hooks
2325
2426def main ():
2527 parser = argparse .ArgumentParser (description = DESCRIPTION )
28+ shtab .add_argument_to (parser )
2629 parser .add_argument (
2730 "--version" ,
2831 action = "version" ,
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ python = "^3.9"
4141tomlkit = " >=0.5.11"
4242pontos = " >=22.8.0"
4343rich = " >=12.5.1"
44+ shtab = " >=1.6.5"
4445
4546[tool .poetry .dev-dependencies ]
4647autohooks-plugin-black = " >=21.12.0"
You can’t perform that action at this time.
0 commit comments