Complete major numbers too (--include/--exclude)
This commit is contained in:
parent
1ecc42490e
commit
fc617458c1
12
src/_lsblk
12
src/_lsblk
|
@ -16,15 +16,23 @@ _lsblk_columns() {
|
||||||
compadd $@ $lsblk_cols_all
|
compadd $@ $lsblk_cols_all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lsblk_major_number() {
|
||||||
|
# /sys/dev/block/ contains MAJOR:MINOR symlinks. eg. 7:0
|
||||||
|
local device_paths=(/sys/dev/block/*(N))
|
||||||
|
local major_numbers=(${${device_paths##*/}%%:*})
|
||||||
|
# major_numbers might have duplicates but compadd handles that
|
||||||
|
compadd $@ $major_numbers
|
||||||
|
}
|
||||||
|
|
||||||
arguments=(
|
arguments=(
|
||||||
'(-a --all)'{-a,--all}'[print all devices]'
|
'(-a --all)'{-a,--all}'[print all devices]'
|
||||||
'(-b --bytes)'{-b,--bytes}'[print size in bytes rather than in human readable format]'
|
'(-b --bytes)'{-b,--bytes}'[print size in bytes rather than in human readable format]'
|
||||||
'(-d --nodeps)'{-d,--nodeps}'[dont print slaves or holders]'
|
'(-d --nodeps)'{-d,--nodeps}'[dont print slaves or holders]'
|
||||||
'(-D --discard)'{-D,--discard}'[print discard capabilities]'
|
'(-D --discard)'{-D,--discard}'[print discard capabilities]'
|
||||||
'(-e --exclude)'{-e,--exclude}'[exclude devices by major number (default: RAM disks)]'
|
'(-e --exclude)'{-e,--exclude}'[exclude devices by major number (default: RAM disks)]:major number:_sequence _lsblk_major_number'
|
||||||
'(-f --fs)'{-f,--fs}'[output info about filesystems]'
|
'(-f --fs)'{-f,--fs}'[output info about filesystems]'
|
||||||
'(-i --ascii)'{-i,--ascii}'[use ascii characters only]'
|
'(-i --ascii)'{-i,--ascii}'[use ascii characters only]'
|
||||||
'(-I --include)'{-I,--include}'[show only devices with specified major numbers]'
|
'(-I --include)'{-I,--include}'=[show only devices with specified major numbers]:major number:_sequence _lsblk_major_number'
|
||||||
'(-J --json)'{-J,--json}'[use JSON output format]'
|
'(-J --json)'{-J,--json}'[use JSON output format]'
|
||||||
'(-l --list)'{-l,--list}'[use list format output]'
|
'(-l --list)'{-l,--list}'[use list format output]'
|
||||||
'(-m --perms)'{-m,--perms}'[output info about permissions]'
|
'(-m --perms)'{-m,--perms}'[output info about permissions]'
|
||||||
|
|
Loading…
Reference in New Issue