Skip to content

Commit 27ae2cb

Browse files
committed
bash completion
1 parent 5f9b0a6 commit 27ae2cb

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ python:
44
- 3.6
55
- 3.7
66
- 3.8
7+
- 3.9
78
script:
89
- python3 tests.py

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ wikipedia.com
4646
+ [Command clauses](#command-clauses)
4747
+ [Input / output](#input--output)
4848
+ [Regular expressions shortcuts](#regular-expressions-shortcuts)
49+
+ [Bash completion](#bash-completion)
4950

5051
# Installation
5152
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
689690
helloworld
690691
anotherwords
691692
```
693+
694+
### Bash completion
695+
1. Run: `apt-get install bash-completion jq`
696+
2. Copy: [extra/pz-autocompletion.bash](./extra/pz-autocompletion.bash) to `/etc/bash_completion.d/`
697+
3. Restart terminal

extra/pz-autocompletion.bash

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
# bash completion for pz
3+
_pz()
4+
{
5+
local cur
6+
local cmd
7+
8+
cur=${COMP_WORDS[$COMP_CWORD]}
9+
cmd=( ${COMP_WORDS[@]} )
10+
11+
if [[ "$cur" == -* ]]; then
12+
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 ) )
13+
return 0
14+
fi
15+
}
16+
17+
complete -F _pz -o default pz

0 commit comments

Comments
 (0)