aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gentoo.org>2014-12-17 18:09:03 -0500
committerTim Harder <radhermit@gentoo.org>2014-12-17 18:09:03 -0500
commitb59abbeb9423d75dc258d900bd3ea7dded586b98 (patch)
tree9c05c03d2109da55fcae5633e434eef4748255d8 /src/_genlop
parentMerge pull request #2 from dset0x/equery-completions (diff)
downloadzsh-completion-b59abbeb9423d75dc258d900bd3ea7dded586b98.tar.gz
zsh-completion-b59abbeb9423d75dc258d900bd3ea7dded586b98.tar.bz2
zsh-completion-b59abbeb9423d75dc258d900bd3ea7dded586b98.zip
use consistent indentation (2 spaces) and add vim modelines
Diffstat (limited to 'src/_genlop')
-rw-r--r--src/_genlop173
1 files changed, 88 insertions, 85 deletions
diff --git a/src/_genlop b/src/_genlop
index 6e817fd..92c844b 100644
--- a/src/_genlop
+++ b/src/_genlop
@@ -1,6 +1,7 @@
#compdef genlop
#genlop 0.30.8
+
_genlop () {
local prev1="$words[CURRENT-1]" prev2="$words[CURRENT-2]" days months arg single state lstate
days=(monday tuesday wednesday thursday friday saturday sunday)
@@ -8,96 +9,98 @@ months=(january february march april may june july august september october nove
arg=( --current -c --time -t --gmt -g --info -i --file -f --rsync -r --unmerge -u --date --search -s --list -l )
single=( --current -c --pretend -p --help -h --version -v )
- [[ ${prev2} == (1st|2nd|3rd|4th|5th) ]] &&
- compadd in\ $months && return 0
- [[ ${prev1} == ([2-9]|[1-9][0-9]*) && ${prev2} != \
- (january|february|march|april|may|june|july|august|september|october|november|december) ]] &&
- _values '' 'days ago' 'months ago' 'years ago' 'weeks ago' && return 0
- [[ ${prev1} == (1) && ${prev2} != \
- (january|february|march|april|may|june|july|august|september|october|november|december) ]] &&
- _values '' 'day ago' 'month ago' 'year ago' 'week ago' && return 0
+ [[ ${prev2} == (1st|2nd|3rd|4th|5th) ]] &&
+ compadd in\ $months && return 0
+ [[ ${prev1} == ([2-9]|[1-9][0-9]*) && ${prev2} != \
+ (january|february|march|april|may|june|july|august|september|october|november|december) ]] &&
+ _values '' 'days ago' 'months ago' 'years ago' 'weeks ago' && return 0
+ [[ ${prev1} == (1) && ${prev2} != \
+ (january|february|march|april|may|june|july|august|september|october|november|december) ]] &&
+ _values '' 'day ago' 'month ago' 'year ago' 'week ago' && return 0
- case "$prev1" in
- last)
- _values '' month week
- compadd $days && return 0
- ;;
- 1st|2nd|3rd|4th|5th)
- compadd $days && return 0
- ;;
- january|february|march|april|may|june|july|august|september|october|november|december)
- compadd {1..31} && return 0
- ;;
- --date)
- _message 'enter number for more options or use mm/dd/yyyy format'
- _values '' \
- last yesterday 1st 2nd 3rd 4th 5th
- _alternative \
- '*:*:_days' '*:*:_months' && return 0
- ;;
- --file|-f)
- _arguments '*:logfile:_files' && return 0
- ;;
- *)
- _arguments \
- "($single $arg *)"{--current,-c}"[display the current merge in action]" \
- "($single)*--date[specify date of event]:date:->date" \
- "($single)*-f[specify the logfile to use]:logfile:_files" \
- "($single --gmt -g)"{--gmt,-g}"[display time in GMT/UTC format (default is local time)]" \
- "($single $arg *)"{--help,-h}"[display help information]" \
- "($single --info -i --list -l)"{--info,-i}"[print brief summary about installed ebuild]" \
- "($single --search -s --info -i --list -l *)"{--list,-l}"[list merge history]" \
- "(--nocolor -n)"{--nocolor,-n}"[disable colored output]" \
- "($single $arg *)"{--pretend,-p}"[estimate build time of a piped emerge -p]" \
- "($single --search -s --info -i --time -t --unmerge -u --rsync -r *)"{--rsync,-r}"[display rsync history]" \
- "($single --rsync -r --search -s --list -l *)"{--search,-s}"[select ebuilds matching the provided regular expression]:pattern:" \
- "($single --time -t)"{--time,-t}"[display merge time]" \
- "($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \
- "($single $arg *)"{--version,-v}"[display version information]" \
- "($single)*:package:_gentoo_packages available"
- ;;
- esac
+ case "$prev1" in
+ last)
+ _values '' month week
+ compadd $days && return 0
+ ;;
+ 1st|2nd|3rd|4th|5th)
+ compadd $days && return 0
+ ;;
+ january|february|march|april|may|june|july|august|september|october|november|december)
+ compadd {1..31} && return 0
+ ;;
+ --date)
+ _message 'enter number for more options or use mm/dd/yyyy format'
+ _values '' \
+ last yesterday 1st 2nd 3rd 4th 5th
+ _alternative \
+ '*:*:_days' '*:*:_months' && return 0
+ ;;
+ --file|-f)
+ _arguments '*:logfile:_files' && return 0
+ ;;
+ *)
+ _arguments \
+ "($single $arg *)"{--current,-c}"[display the current merge in action]" \
+ "($single)*--date[specify date of event]:date:->date" \
+ "($single)*-f[specify the logfile to use]:logfile:_files" \
+ "($single --gmt -g)"{--gmt,-g}"[display time in GMT/UTC format (default is local time)]" \
+ "($single $arg *)"{--help,-h}"[display help information]" \
+ "($single --info -i --list -l)"{--info,-i}"[print brief summary about installed ebuild]" \
+ "($single --search -s --info -i --list -l *)"{--list,-l}"[list merge history]" \
+ "(--nocolor -n)"{--nocolor,-n}"[disable colored output]" \
+ "($single $arg *)"{--pretend,-p}"[estimate build time of a piped emerge -p]" \
+ "($single --search -s --info -i --time -t --unmerge -u --rsync -r *)"{--rsync,-r}"[display rsync history]" \
+ "($single --rsync -r --search -s --list -l *)"{--search,-s}"[select ebuilds matching the provided regular expression]:pattern:" \
+ "($single --time -t)"{--time,-t}"[display merge time]" \
+ "($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \
+ "($single $arg *)"{--version,-v}"[display version information]" \
+ "($single)*:package:_gentoo_packages available"
+ ;;
+ esac
- while [[ -n "$state" ]]; do
- lstate=$state
- state=''
- case "$lstate" in
- date) _message 'enter number for more options or use mm/dd/yyyy format'
- _values '' \
- last yesterday 1st 2nd 3rd 4th 5th
- _alternative \
- ':*:_days' ':*:_months' && return 0
- ;;
- esac
- done
+ while [[ -n "$state" ]]; do
+ lstate=$state
+ state=''
+ case "$lstate" in
+ date) _message 'enter number for more options or use mm/dd/yyyy format'
+ _values '' \
+ last yesterday 1st 2nd 3rd 4th 5th
+ _alternative \
+ ':*:_days' ':*:_months' && return 0
+ ;;
+ esac
+ done
}
_days() {
- local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday"
- local day=$(date +%u)
- if [[ ${day} == 1 ]] then compadd $m
- elif [[ ${day} == 2 ]] then compadd $m $t
- elif [[ ${day} == 3 ]] then compadd $m $t $w
- elif [[ ${day} == 4 ]] then compadd $m $t $w $T
- elif [[ ${day} == 5 ]] then compadd $m $t $w $T $f
- elif [[ ${day} == 6 ]] then compadd $m $t $w $T $f $s
- elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S
- fi
+ local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday"
+ local day=$(date +%u)
+ if [[ ${day} == 1 ]] then compadd $m
+ elif [[ ${day} == 2 ]] then compadd $m $t
+ elif [[ ${day} == 3 ]] then compadd $m $t $w
+ elif [[ ${day} == 4 ]] then compadd $m $t $w $T
+ elif [[ ${day} == 5 ]] then compadd $m $t $w $T $f
+ elif [[ ${day} == 6 ]] then compadd $m $t $w $T $f $s
+ elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S
+ fi
}
_months() {
- local j="january" f="february" m="march" a="april" M="may" ju="june" J="july" A="august" s="september" o="october" n="november" d="december"
- local month=$(date +%m)
- if [[ ${month} == 01 ]] then compadd $j
- elif [[ ${month} == 02 ]] then compadd $j $f
- elif [[ ${month} == 03 ]] then compadd $j $f $m
- elif [[ ${month} == 04 ]] then compadd $j $f $m $a
- elif [[ ${month} == 05 ]] then compadd $j $f $m $a $M
- elif [[ ${month} == 06 ]] then compadd $j $f $m $a $M $ju
- elif [[ ${month} == 07 ]] then compadd $j $f $m $a $M $ju $J
- elif [[ ${month} == 08 ]] then compadd $j $f $m $a $M $ju $J $A
- elif [[ ${month} == 09 ]] then compadd $j $f $m $a $M $ju $J $A $s
- elif [[ ${month} == 10 ]] then compadd $j $f $m $a $M $ju $J $A $s $o
- elif [[ ${month} == 11 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n
- elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d
- fi
+ local j="january" f="february" m="march" a="april" M="may" ju="june" J="july" A="august" s="september" o="october" n="november" d="december"
+ local month=$(date +%m)
+ if [[ ${month} == 01 ]] then compadd $j
+ elif [[ ${month} == 02 ]] then compadd $j $f
+ elif [[ ${month} == 03 ]] then compadd $j $f $m
+ elif [[ ${month} == 04 ]] then compadd $j $f $m $a
+ elif [[ ${month} == 05 ]] then compadd $j $f $m $a $M
+ elif [[ ${month} == 06 ]] then compadd $j $f $m $a $M $ju
+ elif [[ ${month} == 07 ]] then compadd $j $f $m $a $M $ju $J
+ elif [[ ${month} == 08 ]] then compadd $j $f $m $a $M $ju $J $A
+ elif [[ ${month} == 09 ]] then compadd $j $f $m $a $M $ju $J $A $s
+ elif [[ ${month} == 10 ]] then compadd $j $f $m $a $M $ju $J $A $s $o
+ elif [[ ${month} == 11 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n
+ elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d
+ fi
}
+
+# vim: set et sw=2 sts=2 ts=2 ft=zsh: