File: _lscfg

package info (click to toggle)
zsh 5.9-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,856 kB
  • sloc: ansic: 108,138; sh: 6,976; makefile: 722; perl: 687; awk: 291; sed: 16
file content (22 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#compdef lscfg

local state line expl curcontext="$curcontext" disp list devs sep

_arguments -C -s \
  '-l[display device information for named device]:device:->device' \
  '-v[display vital product data for physical devices]' && return 0

if [[ "$state" = device ]]; then
  devs=( ${${${${(f)"$(lscfg)"}[6,-1]:# *}##??}/ ##[^ ]# #/:} )
  if zstyle -T ":completion:${curcontext}:devices" verbose; then
    zstyle -s ":completion:${curcontext}:devices" list-separator sep || sep=--
    zformat -a list " $sep " "$devs[@]"
    disp=(-ld list)
  else
    disp=()
  fi
  _wanted devices expl 'device' compadd "$disp[@]" - "${devs[@]%%:*}"
  return
fi

return 1