pull: couple bash-completion fixes
cover pull: couple bash-completion fixes
Hello Karel and other,
It would have been better to get these in before relese v2.32 got out, so sorry for missing that. I'm sure these fairly trivial corrections are welcome to be part of the next releaese, so perhaps missing one is not great misfortune at the end.
----------------------------------------------------------------
The following changes since commit 6963338ca586bef3370e189f13785b4b6b63bbdb:
dmesg: fix raw output (2018-04-05 15:59:59 +0200)
are available in the Git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git bash-comp
for you to fetch changes up to 1ea4305b1c541333a2c9e4434dc7c3ca05cf188d:
bash-completion: fix typo in blockdev file (2018-04-05 20:49:27 +0100)
----------------------------------------------------------------
Sami Kerola (4):
bash-completion: fix few bash set -u issues
bash-completion: do not print eject --cdspeed error messages
bash-completion: setpriv --securebits argument can be comma separated list
bash-completion: fix typo in blockdev file
bash-completion/blockdev | 2 +- bash-completion/chcpu | 4 ++-- bash-completion/eject | 2 +- bash-completion/lsblk | 10 +++++----- bash-completion/lscpu | 2 +- bash-completion/lslogins | 2 +- bash-completion/lsns | 2 +- bash-completion/mount | 2 +- bash-completion/setpriv | 23 ++++++++++++++++++----- bash-completion/taskset | 2 +- 10 files changed, 32 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.0
PATCH 1/4 bash-completion: fix few bash set -u issues
This is the same fix as in reference commit, and the same reason. Just correct few files missed earlier.
Reference: abbcec4fc9c8d7fb835b4eafd1bc9d82acbf0056
--- bash-completion/chcpu | 4 ++-- bash-completion/lsblk | 10 +++++----- bash-completion/lscpu | 2 +- bash-completion/lslogins | 2 +- bash-completion/lsns | 2 +- bash-completion/mount | 2 +- bash-completion/setpriv | 2 +- bash-completion/taskset | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-)
bash-completion/chcpu +2 -2
@@ -12,7 +12,7 @@ _chcpu_module() CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline) for WORD in $(eval echo $CPULIST_ALL); do if ! [[ $prefix == *"$WORD"* ]]; then - CPULIST="$WORD $CPULIST" + CPULIST="$WORD ${CPULIST:-""}" fi done compopt -o nospace
@@ -26,7 +26,7 @@ _chcpu_module() CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) for WORD in $(eval echo $CPULIST_ALL); do if ! [[ $prefix == *"$WORD"* ]]; then - CPULIST="$WORD $CPULIST" + CPULIST="$WORD ${CPULIST:-""}" fi done compopt -o nospace
bash-completion/lsblk +5 -5
@@ -20,15 +20,15 @@ _lsblk_module() prefix="${cur%$realcur}" for I in /sys/dev/block/*; do J=${I##*/} - MAJOR_ALL="$MAJOR_ALL ${J%%:*}" + MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}" done - for WORD in $MAJOR_ALL; do + for WORD in ${MAJOR_ALL:-""}; do if ! [[ $prefix == *"$WORD"* ]]; then - MAJOR="$WORD $MAJOR" + MAJOR="$WORD ${MAJOR:-""}" fi done compopt -o nospace - COMPREPLY=( $(compgen -P "$prefix" -W "$MAJOR" -S ',' -- $realcur) ) + COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) ) return 0 ;; '-o'|'--output')
@@ -37,7 +37,7 @@ _lsblk_module() prefix="${cur%$realcur}" for WORD in $LSBLK_COLS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then - LSBLK_COLS="$WORD $LSBLK_COLS" + LSBLK_COLS="$WORD ${LSBLK_COLS:-""}" fi done compopt -o nospace
bash-completion/lscpu +1 -1
@@ -15,7 +15,7 @@ _lscpu_module() CONFIGURED ONLINE MAXMHZ MINMHZ" for WORD in $OPTS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then - OPTS="$WORD $OPTS" + OPTS="$WORD ${OPTS:-""}" fi done compopt -o nospace
bash-completion/lslogins +1 -1
@@ -35,7 +35,7 @@ _lslogins_module() prefix="${cur%$realcur}" for WORD in $LSLOGINS_COLS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then - LSLOGINS_COLS="$WORD $LSLOGINS_COLS" + LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}" fi done compopt -o nospace
bash-completion/lsns +1 -1
@@ -14,7 +14,7 @@ _lsns_module() prefix="${cur%$realcur}" for WORD in $LSNS_COLS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then - LSNS_COLS="$WORD $LSNS_COLS" + LSNS_COLS="$WORD ${LSNS_COLS:-""}" fi done compopt -o nospace
bash-completion/mount +1 -1
@@ -15,7 +15,7 @@ _mount_module() prefix="${cur%$realcur}" for WORD in $TYPES; do if ! [[ $prefix == *"$WORD"* ]]; then - TYPE_COLS="$WORD $TYPE_COLS" + TYPE_COLS="$WORD ${TYPE_COLS:-""}" fi done compopt -o nospace
bash-completion/setpriv +1 -1
@@ -38,7 +38,7 @@ _setpriv_module() GIDS_ALL=$(getent group | awk -F: '{print $3}') for WORD in $GIDS_ALL; do if ! [[ $prefix == *"$WORD"* ]]; then - GIDS="$WORD $GIDS" + GIDS="$WORD ${GIDS:-""}" fi done compopt -o nospace
bash-completion/taskset +1 -1
@@ -12,7 +12,7 @@ _taskset_module() CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) for WORD in $(eval echo $CPULIST_ALL); do if ! [[ $prefix == *"$WORD"* ]]; then - CPULIST="$WORD $CPULIST" + CPULIST="$WORD ${CPULIST:-""}" fi done compopt -o nospace
Signature · 1 line
2.17.0
PATCH 2/4 bash-completion: do not print eject --cdspeed error messages
In reply to Sami KerolaBash completion is proposing --cdspeed option argument from 'eject --listspeed /dev/cdrom' output. Nowadays it is common not to have such device, and this results to an unwanted error message to stderr merely messing up command line. Lets stop that.
--- bash-completion/eject | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bash-completion/eject +1 -1
@@ -15,7 +15,7 @@ _eject_module() return 0 ;; '-x'|'--cdspeed') - COMPREPLY=( $(compgen -W "$($1 -X)" -- $cur) ) + COMPREPLY=( $(compgen -W "$(eject --listspeed 2>/dev/null)" -- $cur) ) return 0 ;; '-h'|'--help'|'-V'|'--version')
Signature · 1 line
2.17.0
PATCH 3/4 bash-completion: setpriv --securebits argument can be comma separated list
In reply to Sami KerolaMake the option argument suggestion to match with what is allowed. In same go tidy shell code a little bit.
--- bash-completion/setpriv | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
bash-completion/setpriv +17 -4
@@ -46,10 +46,23 @@ _setpriv_module() return 0 ;; '--securebits') - local SBITS - SBITS="noroot noroot_locked no_setuid_fixup no_setuid_fixup_locked keep_caps_locked - -noroot -noroot_locked -no_setuid_fixup -no_setuid_fixup_locked -keep_caps_locked" - COMPREPLY=( $(compgen -W "$SBITS" -- $cur) ) + local prefix realcur SBITS_ALL SBITS WORD + realcur="${cur##*,}" + prefix="${cur%$realcur}" + SBITS_ALL=" + {+,-}keep_caps_locked + {+,-}noroot + {+,-}noroot_locked + {+,-}no_setuid_fixup + {+,-}no_setuid_fixup_locked + " + for WORD in $SBITS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + SBITS="$WORD ${SBITS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$SBITS" -S ',' -- $realcur) ) return 0 ;; '--selinux-label')
Signature · 1 line
2.17.0
PATCH 4/4 bash-completion: fix typo in blockdev file
In reply to Sami Kerola--- bash-completion/blockdev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bash-completion/blockdev +1 -1
@@ -33,7 +33,7 @@ _blockdev_module() COMPREPLY=( $(compgen -W "bytes" -- $cur) ) return 0 ;; - '--setbsz'|'--setfra') + '--setra'|'--setfra') COMPREPLY=( $(compgen -W "sectors" -- $cur) ) return 0 ;;
Signature · 1 line
2.17.0
Quoted 11 lines · Sami Kerola
bash-completion/blockdev | 2 +- bash-completion/chcpu | 4 ++-- bash-completion/eject | 2 +- bash-completion/lsblk | 10 +++++----- bash-completion/lscpu | 2 +- bash-completion/lslogins | 2 +- bash-completion/lsns | 2 +- bash-completion/mount | 2 +- bash-completion/setpriv | 23 ++++++++++++++++++----- bash-completion/taskset | 2 +- 10 files changed, 32 insertions(+), 19 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com