1
# mcrypt(1) completion by Ariel Fermani <the_end@bbs.frc.utn.edu.ar>
3
have mcrypt || have mdecrypt &&
6
local cur prev i decrypt
9
_get_comp_words_by_ref cur prev
13
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
17
COMPREPLY=( $( compgen -W '$( mcrypt --list-keymodes \
18
2>/dev/null )' -- "$cur" ) )
22
COMPREPLY=( $( compgen -W "$( mcrypt --list \
23
2>/dev/null | sed -e 's/.*: //' -e 's/ $//' | \
24
sort -u )" -- "$cur" ) )
28
COMPREPLY=( $( compgen -W "$( mcrypt --list 2>/dev/null | \
29
awk '{print $1}' )" -- "$cur" ) )
33
COMPREPLY=( $( compgen -W '$( mcrypt --list-hash 2>/dev/null | \
34
sed -e 1d )' -- "$cur" ) )
37
-k|-s|--key|--keysize)
40
-f|-c|--keyfile|--config)
44
--algorithms-directory|--modes-directory)
50
if [[ "$cur" == -* ]]; then
51
COMPREPLY=( $( compgen -W '--openpgp --openpgp-z \
52
--decrypt --keysize --keymode --keyfile \
53
--config --algorithm --algorithms-directory \
54
--mode --modes-directory --hash --key \
55
--noiv --bare --gzip --bzip2 --flush \
56
--doublecheck --unlink --nodelete --time \
57
--force --echo --random --list --list-keymodes \
58
--list-hash --verbose --quiet --help \
59
--version --license' -- "$cur" ) )
60
elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
64
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
65
if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
71
if [[ $decrypt -eq 0 ]]; then
76
complete -F _mcrypt mcrypt mdecrypt
81
# sh-indent-comment: t
82
# indent-tabs-mode: nil
84
# ex: ts=4 sw=4 et filetype=sh