From c8d15f924c79cdf5018a52dc07bb445fbf85c16b Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 28 Feb 2018 09:57:47 -0600 Subject: [PATCH] Show device description when bash completing an argument --- data/bash-completion/fwupdmgr | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/data/bash-completion/fwupdmgr b/data/bash-completion/fwupdmgr index f28aca832..923cd85c1 100644 --- a/data/bash-completion/fwupdmgr +++ b/data/bash-completion/fwupdmgr @@ -45,13 +45,12 @@ _show_modifiers() _show_device_ids() { - local devices - devices="$(command fwupdmgr get-devices | command awk '/DeviceId/ { print $2}')" - COMPREPLY+=( $(compgen -W "${devices}" -- "$cur") ) -#it would be nice to show device description but fwupd really doesn't like extraneous data -# local description -# description="$(command fwupdmgr get-devices | command awk '!/DeviceId/ { line = $0 }; /DeviceId/ { print $2 " " line}')" -# COMPREPLY+=( $(compgen -W "${description}" -- "$cur") ) + local description + OLDIFS=$IFS + IFS=$'\n' + description="$(command fwupdmgr get-devices | command awk '!/DeviceId/ { line = $0 }; /DeviceId/ { print $2 " {" line "}"}')" + COMPREPLY+=( $(compgen -W "${description}" -- "$cur") ) + IFS=$OLDIFS } _show_remotes() @@ -155,4 +154,4 @@ _fwupdmgr() return 0 } -complete -F _fwupdmgr fwupdmgr \ No newline at end of file +complete -F _fwupdmgr fwupdmgr