mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
49 lines
1.2 KiB
Text
49 lines
1.2 KiB
Text
#compdef quilt
|
|
|
|
local -a tmp
|
|
local rc
|
|
|
|
_arguments \
|
|
'--trace' \
|
|
'--quiltrc:config file:_files' \
|
|
'--version' \
|
|
':quilt command:(add files import previous setup annotate fold mail push
|
|
snapshot applied fork new refresh top delete graph next remove unapplied
|
|
diff grep patches rename upgrade edit header pop series)' \
|
|
'*::subcmd:->subcmd' && return 0
|
|
|
|
case "$state" in
|
|
(subcmd)
|
|
|
|
case "$words[1]" in
|
|
(applied|delete|files|graph|header|next|previous|refresh|unapplied)
|
|
_wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"}
|
|
;;
|
|
(push)
|
|
if (( CURRENT == 2 )); then
|
|
tmp=( ${(f)"$(quilt unapplied 2>&1)"} )
|
|
rc=$?
|
|
if (( rc == 0 )); then
|
|
_wanted -V 'unapplied patches' expl 'patch' compadd "${tmp[@]}"
|
|
else
|
|
_message "No unapplied patches"
|
|
fi
|
|
fi
|
|
;;
|
|
(pop)
|
|
if (( CURRENT == 2 )); then
|
|
tmp=( ${(f)"$(quilt applied 2>&1)"} )
|
|
rc=$?
|
|
if (( rc == 0 )); then
|
|
_wanted -V 'applied patches' expl 'patch' compadd "${tmp[@]}"
|
|
else
|
|
_message "No applied patches"
|
|
fi
|
|
fi
|
|
;;
|
|
(*)
|
|
_files
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|