[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] dmidecode completion: Use --list-strings and --list-types
From: |
Jean Delvare |
Subject: |
[PATCH] dmidecode completion: Use --list-strings and --list-types |
Date: |
Wed, 29 Nov 2023 13:42:00 +0100 |
Use the new options --list-strings and --list-types to simplify the
completion of --string and --type options, respectively. This also
fixes a bug (trailing "n" being stripped) as a side effect.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
completion/dmidecode.bash | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
--- dmidecode.orig/completion/dmidecode.bash
+++ dmidecode/completion/dmidecode.bash
@@ -17,19 +17,11 @@ _comp_cmd_dmidecode() {
return 0
;;
-s | --string)
- COMPREPLY=($(compgen -W '$(
- "$1" --string 2>&1 | while IFS=\$'\\n' read -r line ; do
- [[ $line == " "* ]] && printf "%s\n" "$line"
- done
- )' -- "$cur"))
+ COMPREPLY=($(compgen -W '$("$1" --list-strings)' -- "$cur"))
return 0
;;
-t | --type)
- COMPREPLY=($(compgen -W '$(
- "$1" --type 2>&1 | while IFS=\$'\\n' read -r line ; do
- [[ $line == " "* ]] && printf "%s\n" "$line"
- done
- )' -- "$cur"))
+ COMPREPLY=($(compgen -W '$("$1" --list-types)' -- "$cur"))
return 0
;;
--dump-bin | --from-dump)
@@ -49,7 +41,9 @@ _comp_cmd_dmidecode() {
--help
--quiet
--string
+ --list-strings
--type
+ --list-types
--handle
--dump
--dump-bin
--
Jean Delvare
SUSE L3 Support
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] dmidecode completion: Use --list-strings and --list-types,
Jean Delvare <=