mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 08:58:28 +01:00
Merge branch 'master' of https://github.com/0rax/cheat into 0rax-master
* 'master' of https://github.com/0rax/cheat: Added autocomplete for bash
This commit is contained in:
commit
cef9cde3f3
2 changed files with 16 additions and 1 deletions
14
cheat-completion.bash
Normal file
14
cheat-completion.bash
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# Autocomplete for cheat.py
|
||||
# Copyright (c) 2013, Jean-Philippee "Orax" Roemer
|
||||
#
|
||||
|
||||
function _cheat_autocomplete {
|
||||
sheets=$(cheat | tail -n +17 | cut -d' ' -f1)
|
||||
COMPREPLY=()
|
||||
if [ $COMP_CWORD = 1 ]; then
|
||||
COMPREPLY=(`compgen -W "$sheets" -- $2`)
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _cheat_autocomplete cheat
|
3
setup.py
3
setup.py
|
@ -17,5 +17,6 @@ setup(name='cheat',
|
|||
package_data={'cheatsheets': [f for f in os.listdir('cheatsheets')
|
||||
if '.' not in f]},
|
||||
scripts=['cheat'],
|
||||
data_files=[('/usr/share/zsh/site-functions', ['_cheat'])]
|
||||
data_files=[('/usr/share/zsh/site-functions', ['_cheat']),
|
||||
('/etc/bash_completion.d', ['cheat-completion.bash'])]
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue