mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Fix cap completion, via hpoydar
This commit is contained in:
parent
8113ebd142
commit
def5cf39b4
3 changed files with 45 additions and 42 deletions
24
lib/cap.zsh
Normal file
24
lib/cap.zsh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# May need to trash `.zcompdump` and regenerate it
|
||||
# with `compinit` for this to work
|
||||
|
||||
_cap_does_task_list_need_generating () {
|
||||
if [ ! -f .cap_tasks~ ]; then return 0;
|
||||
else
|
||||
accurate=$(stat -f%m .cap_tasks~)
|
||||
changed=$(stat -f%m config/deploy.rb)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
}
|
||||
|
||||
_cap () {
|
||||
if [ -f capfile ]; then
|
||||
if _cap_does_task_list_need_generating; then
|
||||
echo "\nGenerating .cap_tasks~..." > /dev/stderr
|
||||
cap -vT | awk 'FB != 1 {if ($0 ~ /^$/){FB=1}else{print $2}}' > .cap_tasks~
|
||||
fi
|
||||
compadd `cat .cap_tasks~`
|
||||
fi
|
||||
}
|
||||
|
||||
compctl -K _cap cap
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue