summaryrefslogtreecommitdiffstats
path: root/Completion/Linux/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2025-01-27 23:06:16 +0100
committerOliver Kiddle <opk@zsh.org>2025-01-27 23:06:16 +0100
commitf3b865b9155269ba0dee7ced93b061e78df507c1 (patch)
tree7ff3e71038dfd5ab7c9e88a82980fd4d85637563 /Completion/Linux/Command
parent53325: cover newer BSD releases in completion (diff)
downloadzsh-f3b865b9155269ba0dee7ced93b061e78df507c1.tar
zsh-f3b865b9155269ba0dee7ced93b061e78df507c1.tar.gz
zsh-f3b865b9155269ba0dee7ced93b061e78df507c1.tar.bz2
zsh-f3b865b9155269ba0dee7ced93b061e78df507c1.tar.lz
zsh-f3b865b9155269ba0dee7ced93b061e78df507c1.tar.xz
zsh-f3b865b9155269ba0dee7ced93b061e78df507c1.tar.zst
zsh-f3b865b9155269ba0dee7ced93b061e78df507c1.zip
53326: completion updates for core Linux utils
Diffstat (limited to 'Completion/Linux/Command')
-rw-r--r--Completion/Linux/Command/_findmnt14
-rw-r--r--Completion/Linux/Command/_free1
-rw-r--r--Completion/Linux/Command/_losetup3
-rw-r--r--Completion/Linux/Command/_lsblk7
-rw-r--r--Completion/Linux/Command/_pidof1
-rw-r--r--Completion/Linux/Command/_slabtop2
-rw-r--r--Completion/Linux/Command/_wipefs3
7 files changed, 23 insertions, 8 deletions
diff --git a/Completion/Linux/Command/_findmnt b/Completion/Linux/Command/_findmnt
index b29372c39..6155d4dc1 100644
--- a/Completion/Linux/Command/_findmnt
+++ b/Completion/Linux/Command/_findmnt
@@ -8,6 +8,7 @@
#
local curcontext=$curcontext state state_descr line ret=1
typeset -A opt_args
+local -a suf dedup
_arguments -s -C \
'(H -A --all)'{-A,--all}'[print all filesystems]' \
@@ -45,6 +46,7 @@ _arguments -s -C \
'(H)2:: :->targets' \
+ '(format)' \
'(H)'{-D,--df}'[imitate the output of df command]' \
+ '(H)'{-I,--dfi}'[imitate the output of df with -i option]' \
'(H)'{-J,--json}'[use JSON output format]' \
'(H)'{-l,--list}'[use list output format]' \
'(H)'{-P,--pairs}'[use key="value" output format]' \
@@ -55,6 +57,7 @@ _arguments -s -C \
'(H)'{-N+,--task=}'[search /proc/<pid>/mountinfo]: :_pids' \
'(H)'{-s,--fstab}'[search in /etc/fstab]' \
+ '(H)' \
+ '(* -)'{-H,--list-columns}'[list available columns]' \
'(- :)'{-h,--help}'[display help text and exit]' \
'(- :)'{-V,--version}'[display version and exit]' \
&& ret=0
@@ -66,13 +69,16 @@ __findmnt_mountpoints () {
case $state in
columns)
+ dedup=( ${(Ms.,.)${PREFIX#+}##*,} ${(Ms.,.)SUFFIX%%,*} )
+ suf=( -qS , )
+ compset -S ',*' && suf=()
compset -P '+' || _describe -t list-prefixes prefix \
- '( +:"not replace but extend the list" )' -S '' && ret=0
+ '( +:"not replace but extend the list" )' -S '' && ret=0
+ compset -P '*,'
local -a columns=(
- ${${${(f)"$(_call_program columns findmnt -h)"}[(r)Available*,-2]}[2,-1]}
+ ${${${${(f)"$(_call_program columns findmnt --list-columns)"}## #}//:/\\:}/ <[^>]#> #/:}
)
- columns=( ${${${${${${columns## #}//:/\\:}//\[/\\[}//]/\\]}/ /[}/%/]} )
- _values -s , -M 'm:{a-z}={A-Z}' column $columns && ret=0
+ _describe -t fields column columns -M 'm:{a-z}={A-Z}' $suf -F dedup && ret=0
;;
*) # call "findmnt $opts" to get possible sources/targets
local opts='-lnve'
diff --git a/Completion/Linux/Command/_free b/Completion/Linux/Command/_free
index a0da97446..376b8a21f 100644
--- a/Completion/Linux/Command/_free
+++ b/Completion/Linux/Command/_free
@@ -2,6 +2,7 @@
_arguments -s \
'(-l --lohi)'{-l,--lohi}'[show detailed low and high memory statistics]' \
+ '(-L --line)'{-L,--line}'[show output on a single line]' \
'(-t --total)'{-t,--total}'[show total for RAM + swap]' \
'(-v --committed)'{-v,--committed}'[show committed memory and commit limit]' \
'(-w --wide)'{-w,--wide}'[wide mode]' \
diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup
index f5a7ec1b1..d8e792aaf 100644
--- a/Completion/Linux/Command/_losetup
+++ b/Completion/Linux/Command/_losetup
@@ -18,7 +18,7 @@ _arguments -s -S \
- 'info' \
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
'(-o --offset -a --all)'{-a,--all}'[show the status of all loop devices]' \
- '(-O --output --output-all)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \
+ '(-O --output --output-all)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd -M "B\:+=" - name autoclear back-file back-ino back-maj\:min back-maj back-min maj\:min maj min offset partscan ref ro sizelimit dio log-sec' \
'(-O --output)--output-all[output all columns]' \
'(-J --json --raw -O --output -n --noheadings)'{-J,--json}'[use JSON --list output format]' \
'(-l --list)'{-l,--list}'[list currently used loop devices]' \
@@ -33,6 +33,7 @@ _arguments -s -S \
{-D,--detach-all}'[detach all associated loop devices]' \
- 'create' \
'--direct-io[open backing file with O_DIRECT]::enable:(on off)' \
+ '--loop-ref=[specify loop device reference]:string' \
'(-f --find 1)'{-f,--find}'[find the first unused loop device]' \
'(-L --nooverlap)'{-L,--nooverlap}'[avoid possible conflict between devices]' \
'(-P --partscan)'{-P,--partscan}'[scan the partition table of newly created loop devices]' \
diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk
index 63aac743c..c8b30eb5e 100644
--- a/Completion/Linux/Command/_lsblk
+++ b/Completion/Linux/Command/_lsblk
@@ -8,6 +8,10 @@ typeset -A opt_args
_arguments -C -s -S \
'(H -A --noempty)'{-A,--noempty}"[don't print empty devices]" \
'(H -E --dedup)'{-E+,--dedup=}'[de-duplicate output by specified column]:column:->columns' \
+ '(H -Q --filter)'{-Q+,--filter=}'[only print lines matching expression]:expression' \
+ '(H)--highlight=[color lines matching expression]:expression' \
+ '(H)*--ct-filter=[restrict the next counter]:expression' \
+ '(H)*--ct=[define a custom counter]:name\:param\:func' \
'(H -a --all)'{-a,--all}'[print all devices]' \
'(H -b --bytes)'{-b,--bytes}'[print size in bytes rather than in human readable format]' \
'(H -d --nodeps)'{-d,--nodeps}"[don't print slaves or holders]" \
@@ -40,6 +44,7 @@ _arguments -C -s -S \
'(H)'{-P,--pairs}'[use key="value" output format]' \
'(H)'{-r,--raw}'[use raw output format]' \
+ 'H' \
+ '(* -)'{-H,--list-columns}'[list the available columns]' \
'(* -)'{-h,--help}'[display help information]' \
'(* -)'{-V,--version}'[display version information]' && ret=0
@@ -56,7 +61,7 @@ case $state in
;|
column*)
values=(
- ${${${${(f)"$(_call_program columns lsblk -h)"}[(r)Available*,-2]## #}[2,-1]//:/\\:}/ /:}
+ ${${${${(f)"$(_call_program columns lsblk --list-columns)"}## #}//:/\\:}/ <[^>]#> #/:}
)
_describe -t fields column values -M 'm:{a-z}={A-Z}' $suf -F dedup && ret=0
;;
diff --git a/Completion/Linux/Command/_pidof b/Completion/Linux/Command/_pidof
index 151a0e0f6..fdafd507d 100644
--- a/Completion/Linux/Command/_pidof
+++ b/Completion/Linux/Command/_pidof
@@ -17,6 +17,7 @@ case $variant in
'(-w --with-workers)'{-w,--with-workers}'[show kernel workers too]' \
"(-x $exargs)"-x'[include shells running named scripts]' \
"($exargs)"\*{-o+,--omit-pid=}'[omit processes with PIDs]:pids:_sequence -s , _pids' \
+ '(-t --lightweight)'{-t,--lightweight}'[list threads too]' \
'(-S --separator)'{-S+,--separator=}'[specify separator put between PIDs]:separator' \
'*:process:->procnames' \