summaryrefslogtreecommitdiff
path: root/Completion/Linux/Command/_lsblk
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Linux/Command/_lsblk')
-rw-r--r--Completion/Linux/Command/_lsblk12
1 files changed, 9 insertions, 3 deletions
diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk
index 1a3687c45..8a9bc18bf 100644
--- a/Completion/Linux/Command/_lsblk
+++ b/Completion/Linux/Command/_lsblk
@@ -1,11 +1,12 @@
#compdef lsblk
local sep ret=1
-local -a values dedup suf=( -qS , )
+local -a values dedup suf
local curcontext="$curcontext" state line expl
typeset -A opt_args
_arguments -C -s -S \
+ '(H -E --dedup)'{-E+,--dedup=}'[de-duplicate output by specified column]:column:->columns' \
'(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]" \
@@ -30,7 +31,7 @@ _arguments -C -s -S \
'(H)'{-i,--ascii}'[output ascii characters only]' \
'(H)'{-J,--json}'[use JSON output format]' \
'(H)'{-l,--list}'[use list format output]' \
- '(H)'{-t,--tree}'[use tree format output]' \
+ '(H)'{-T+,--tree=}'[use tree format output]:column:->columns' \
'(H)'{-P,--pairs}'[use key="value" output format]' \
'(H)'{-r,--raw}'[use raw output format]' \
+ 'H' \
@@ -38,14 +39,19 @@ _arguments -C -s -S \
'(* -)'{-V,--version}'[display version information]' && ret=0
case $state in
+ columnlist)
+ compset -P '+' || _describe -t list-prefixes prefix \
+ '( +:"not replace but extend the list" )' -S '' && ret=0
+ ;|
*list)
dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} )
+ suf=( -qS , )
compset -S ',*' && suf=()
compset -P '*,'
;|
column*)
values=(
- ${${${${(f)"$(_call_program columns lsblk -h)"}[(r)Available*,-3]## #}[2,-1]//:/\\:}/ /:}
+ ${${${${(f)"$(_call_program columns lsblk -h)"}[(r)Available*,-2]## #}[2,-1]//:/\\:}/ /:}
)
_describe -t fields column values -M 'm:{a-z}={A-Z}' $suf -F dedup && ret=0
;;