summaryrefslogtreecommitdiff
path: root/Completion/BSD/Command/_acpiconf
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/BSD/Command/_acpiconf
parent841bce705a58b04220b1f257abcc00ae71cbdbdc (diff)
parent001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff)
downloadzsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz
zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/BSD/Command/_acpiconf')
-rw-r--r--Completion/BSD/Command/_acpiconf28
1 files changed, 28 insertions, 0 deletions
diff --git a/Completion/BSD/Command/_acpiconf b/Completion/BSD/Command/_acpiconf
new file mode 100644
index 000000000..817a2f1ad
--- /dev/null
+++ b/Completion/BSD/Command/_acpiconf
@@ -0,0 +1,28 @@
+#compdef acpiconf
+
+local curcontext="$curcontext" sep ret=1
+local -a state line modes desc
+local -A opt_args
+
+_arguments -s \
+ '(-)-h[display usage information]' \
+ '(-)-i[get battery information]:battery' \
+ '(-)-k[ack or abort a pending suspend]:ack' \
+ '(-)-s[enter specified sleep mode]: :->modes' && ret=0
+
+if [[ -n $state ]]; then
+ modes=( $(_call_program modes sysctl -n hw.acpi.supported_sleep_state) )
+ zstyle -s ":completion:${curcontext}:modes" list-separator sep || sep=--
+ (( $#modes )) || modes=( S3 S4 )
+ desc=(
+ "S1 $sep stop the processor clock"
+ "S2 $sep low wake latency sleep state"
+ "S3 $sep suspend to RAM"
+ "S4 $sep suspend to disk"
+ "S5 $sep soft off state"
+ )
+ desc=( ${(M)desc:#(${(~j.|.)modes}) *} )
+ _wanted modes expl 'mode' compadd -M 'B:S=' -ld desc - ${modes#S} && ret=0
+fi
+
+return ret