mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
Without this in the "xl help" line for pci-list-assignable-devices the command name merges with the first word of the help. Since the bash completion support parses "xl help" this leads to "pci-list-assignable-devicesList" being presented as an option instead of the correct command name. We also need to filter out lines which start with more than one space in the bash completion support to stop "List" appearing as a possible command name after the change to wrap it. Doesn't address the fact that some help text overflows 80 columns. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
22 lines
408 B
Bash
22 lines
408 B
Bash
#!/bin/bash
|
|
# Copy this file to /etc/bash_completion.d/xl.sh
|
|
|
|
_xl()
|
|
{
|
|
local IFS=$'\n,'
|
|
|
|
local cur opts xl
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
xl=xl
|
|
|
|
if [[ $COMP_CWORD == 1 ]] ; then
|
|
opts=`${xl} help 2>/dev/null | sed '1,4d' | awk '/^ [^ ]/ {print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
return 0
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
complete -F _xl -o nospace -o default xl
|