summaryrefslogtreecommitdiffstats
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_configure24
-rw-r--r--Completion/Unix/Command/_gcc12
-rw-r--r--Completion/Unix/Command/_shutdown59
3 files changed, 70 insertions, 25 deletions
diff --git a/Completion/Unix/Command/_configure b/Completion/Unix/Command/_configure
index 3b22b53db..460144ac3 100644
--- a/Completion/Unix/Command/_configure
+++ b/Completion/Unix/Command/_configure
@@ -1,6 +1,11 @@
#compdef configure config.status
-_arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \
+local ret=1
+local -a expl suf
+
+[[ -prefix - ]] ||
+ ! zstyle -T ":completion:${curcontext}:options" prefix-needed &&
+ _arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \
-s '((#s)--disable- --enable-
(#s)--enable- --disable-
(#s)--with- --without-
@@ -8,4 +13,19 @@ _arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \
'*=(E|)PREFIX*:prefix directory:_files -/' \
'*=PROGRAM*:program:_command_names -e' \
'*=NAME*executable*:program:_command_names -e' \
- '*=NAME*:file:_files'
+ '*=NAME*:file:_files' && ret=0
+
+if [[ ! -prefix - ]]; then
+ if [[ "$PREFIX" = *\=* ]]; then
+ compstate[parameter]="${PREFIX%%\=*}"
+ compset -P 1 '*='
+ _value && ret=0
+ else
+ compset -S '=*' || suf=( -S = )
+ _wanted -x variables expl variable compadd $suf \
+ CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS DEFS ERLCFLAGS FCFLAGS \
+ FFLAGS GOFLAGS LDFLAGS LIBS OBJCFLAGS OBJCXXFLAGS && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 17b9aa133..cf1cf7efa 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -1,10 +1,18 @@
-#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-*
+#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -value-,CC,-default- -value-,CXX,-default- -P gcc-* -P g++-* -P c++-*
local curcontext="$curcontext" state line ret=1 expl i
local -a args args2 warnings arch
typeset -A opt_args
-if [[ "$service" = -value-* ]]; then
+if [[ "$service" = -value-,CC,* ]]; then
+ _description compilers expl compiler
+ compadd "$expl[@]" -M 'r:|-=* r:|=*' -k 'commands[(I)(clang|([ig]|sun|open)cc(|<->|-devel)|icx)]'
+ return
+elif [[ "$service" = -value-,CXX,* ]]; then
+ _description compilers expl compiler
+ compadd "$expl[@]" -M 'r:|-=* r:|=*' -k 'commands[(I)((clang|g)++(|<->|-devel)|(sun|open|)CC|icpx)]'
+ return
+elif [[ "$service" = -value-* ]]; then
compset -q
words=( fake "$words[@]" )
(( CURRENT++ ))
diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown
index ab98a4325..fdadd3b12 100644
--- a/Completion/Unix/Command/_shutdown
+++ b/Completion/Unix/Command/_shutdown
@@ -1,35 +1,39 @@
#compdef shutdown
-local -a args
+local curcontext="$curcontext" variant="$OSTYPE" ret=1
+local -a state line args suffixes
-if [[ -d /run/systemd/system ]]; then
- _arguments \
- '--help[display usage information]' \
- '(-H --halt)'{-H,--halt}'[halt the machine]' \
- '(-P --poweroff -h)'{-P,--poweroff,-h}'[power-off the machine (default)]' \
- '(-r --reboot)'{-r,--reboot}'[reboot the machine]' \
- "(--no-wall)-k[don't shutdown, just write wall message]" \
- "(-k)--no-wall[don't send a wall message]" \
- '-c[cancel pending shutdown]' \
- '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' \
- '*:warning message'
- return
-fi
+[[ -d /run/systemd/system ]] && variant=systemd
-case $OSTYPE in
+case $variant in
+ systemd)
+ args=(
+ "(-k)--no-wall[don't send a wall message]"
+ '1: :->times'
+ '*:warning message'
+ + '(action)'
+ '(* : -)--help[display usage information]'
+ "(--no-wall)-k[don't shutdown, just write wall message]"
+ {-H,--halt}'[halt the machine]'
+ {-P,--poweroff,-h}'[power-off the machine (default)]'
+ {-r,--reboot}'[reboot the machine]'
+ '-c[cancel pending shutdown]'
+ )
+ ;;
*bsd*|dragonfly*|linux*|darwin*)
args=(
- '-h[halt the system after shutdown]'
- '-r[reboot the system]'
+ '(-p -r -c)-h[halt the system after shutdown]'
+ '(-p -h -c)-r[reboot the system]'
'-k[kick everybody off]'
'-n[prevent file system cache from being flushed]'
- '1:time (hh\:mm/+mins):_phony now -- _guard "^-*" "time (hh\:mm/+mins)"' \
+ '1: :->times'
+ '(*)-[read warning message from standard input]' \
'*:warning message'
)
;|
*bsd*|dragonfly*)
args+=(
- '-p[turn off power after shutdown]'
+ '(-h -r -c)-p[turn off power after shutdown]'
)
;|
(net|open)bsd*)
@@ -39,13 +43,14 @@ case $OSTYPE in
)
;|
freebsd*|dragonfly*)
+ suffixes=( s:seconds :m:minutes h:hours )
args+=(
'-o[execute halt or reboot instead of sending a signal to init]'
)
;|
freebsd<12->.*)
args+=(
- '-c[power cycle the system instead of halting if possible]'
+ '(-h -r -p)-c[power cycle the system instead of halting if possible]'
)
;;
netbsd*)
@@ -74,4 +79,16 @@ case $OSTYPE in
;;
esac
-_arguments $args
+_arguments -C $args && ret=0
+
+if [[ -n $state ]]; then
+ if compset -P '+'; then
+ _numbers -u minutes "grace period" $suffixes
+ else
+ _alternative \
+ 'relative-times:relative time:{ compadd "$expl[@]" -S "" +; compadd "$expl[@]" now }' \
+ 'absolute-times: :_guard "^-*" "time ([yymmdd]hhmm)"' && ret=0
+ fi
+fi
+
+return ret