summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_nice
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
commit26e09889646be3ea65b4a3dfeda26213e4bb6a27 (patch)
tree4f3c73a9416bf47ad7e125383d23cf42879e38d7 /Completion/Unix/Command/_nice
parent841bce705a58b04220b1f257abcc00ae71cbdbdc (diff)
parent001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff)
downloadzsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz
zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_nice')
-rw-r--r--Completion/Unix/Command/_nice27
1 files changed, 18 insertions, 9 deletions
diff --git a/Completion/Unix/Command/_nice b/Completion/Unix/Command/_nice
index 29070697f..b52e5216a 100644
--- a/Completion/Unix/Command/_nice
+++ b/Completion/Unix/Command/_nice
@@ -1,14 +1,23 @@
#compdef nice
-shift words
-(( CURRENT-- ))
+local -a specs=( '*:: : _normal -p $service' )
-if [[ $CURRENT -gt 1 && $words[1] = ([-+](-|)|-n)<-> ]]; then
- shift words
- (( CURRENT -- ))
-elif [[ $CURRENT -gt 2 && $words[1] = -n ]]; then
- shift 2 words
- (( CURRENT -= 2 ))
+# See if the 1st arg is such as -10 --10 or -+10
+if [[ $words[2] = -(-|+|)[0-9]## ]]; then
+ if (( $CURRENT == 2 )); then
+ _message 'niceness increment' && return
+ fi
+ compset -n 2 # Ignore the 1st arg
+else
+ if _pick_variant gnu=GNU unix --version; then
+ specs+=(
+ '(-)'{-n+,--adjustment=}'[adjust niceness]:niceness increment'
+ '(* -)--help[display help and exit]'
+ '(* -)--version[output version information and exit]'
+ )
+ else
+ specs+=( '-n+[specify increment of niceness]:niceness increment' )
+ fi
fi
-_normal
+_arguments : $specs