1
0
mirror of https://github.com/CZ-NIC/pz.git synced 2022-02-13 01:03:07 +03:00

bash completion

This commit is contained in:
Edvard Rejthar
2021-03-19 17:24:37 +01:00
parent 5f9b0a63be
commit 27ae2cb2fb
3 changed files with 24 additions and 0 deletions

View File

@@ -4,5 +4,6 @@ python:
- 3.6
- 3.7
- 3.8
- 3.9
script:
- python3 tests.py

View File

@@ -46,6 +46,7 @@ wikipedia.com
+ [Command clauses](#command-clauses)
+ [Input / output](#input--output)
+ [Regular expressions shortcuts](#regular-expressions-shortcuts)
+ [Bash completion](#bash-completion)
# Installation
Install with a single command from [PyPi](https://pypi.org/project/pz/).
@@ -689,3 +690,8 @@ As seen, `a` was incremented 3× times and `b` on twice because we had to proces
helloworld
anotherwords
```
### Bash completion
1. Run: `apt-get install bash-completion jq`
2. Copy: [extra/pz-autocompletion.bash](./extra/pz-autocompletion.bash) to `/etc/bash_completion.d/`
3. Restart terminal

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# bash completion for pz
_pz()
{
local cur
local cmd
cur=${COMP_WORDS[$COMP_CWORD]}
cmd=( ${COMP_WORDS[@]} )
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "-h --help -v --verbose -q --quiet -S --setup -E --end -F --filter -f --format -w --whole -n -1 -0 --empty -g --generate --stderr --overflow-safe --search --match --findall --sub" -- $cur ) )
return 0
fi
}
complete -F _pz -o default pz