mirror of
https://github.com/cheat/cheat.git
synced 2025-09-06 03:52:55 +02:00
Merge pull request #107 from a-sk/fix-zsh-autocompletion
Fix zsh autocompletion
This commit is contained in:
5
autocompletion/_cheat.zsh
Normal file
5
autocompletion/_cheat.zsh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#compdef cheat
|
||||||
|
|
||||||
|
declare -a cheats
|
||||||
|
cheats=$(cheat -l | cut -d' ' -f1)
|
||||||
|
_arguments "1:cheats:(${cheats})" && return 0
|
@ -1,12 +0,0 @@
|
|||||||
#compdef cheat
|
|
||||||
|
|
||||||
declare -a cheats cheats_in_this_dir
|
|
||||||
|
|
||||||
for directory in $(cheat --cheat_directories); do
|
|
||||||
cheats_in_this_dir=($directory/*(N:r:t))
|
|
||||||
[[ ${#cheats_in_this_dir} > 0 ]] && cheats+=($cheats_in_this_dir)
|
|
||||||
done
|
|
||||||
|
|
||||||
_arguments "1:cheats:(${cheats})"
|
|
||||||
|
|
||||||
return 1
|
|
2
setup.py
2
setup.py
@ -17,6 +17,6 @@ setup(name='cheat',
|
|||||||
package_data={'cheatsheets': [f for f in os.listdir('cheatsheets')
|
package_data={'cheatsheets': [f for f in os.listdir('cheatsheets')
|
||||||
if '.' not in f]},
|
if '.' not in f]},
|
||||||
scripts=['cheat'],
|
scripts=['cheat'],
|
||||||
data_files=[('/usr/share/zsh/site-functions', ['autocompletion/cheat.zsh']),
|
data_files=[('/usr/share/zsh/site-functions', ['autocompletion/_cheat.zsh']),
|
||||||
('/etc/bash_completion.d' , ['autocompletion/cheat.bash'])]
|
('/etc/bash_completion.d' , ['autocompletion/cheat.bash'])]
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user