Merge pull request #1859 from tbhaxor/feature/completion/dmidecode

Feature/completion/dmidecode
This commit is contained in:
Noah Gorny
2021-04-22 01:41:56 +03:00
committed by GitHub
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# shellcheck shell=bash
function __dmidecode_completion() {
local prev=$(_get_pword)
local curr=$(_get_cword)
case $prev in
-s | --string | -t | --type)
OPTS=$(dmidecode "$prev" 2>&1 | grep -E '^ ' | sed 's/ *//g')
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$OPTS" -- "$curr"))
;;
dmidecode)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr"))
;;
esac
}
complete -F __dmidecode_completion dmidecode