mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-19 07:40:42 +01:00
cli: fix bash completion for curser not at EOL
If the curser is not at the end of the line, we want to complete by ignoring everything right of the curser. However, the variable $cur is set to the spaces since the last word, so we have to get rid of them first Without this, the following did not complete: $ nmcli connection modify id <TAB> lo because $cur is set to ' '. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
ce370fab64
commit
93f5687d7b
1 changed files with 7 additions and 0 deletions
|
|
@ -544,6 +544,13 @@ _nmcli()
|
|||
words[i]="$(echo "${words[i]}" | xargs 2>/dev/null || true)"
|
||||
done
|
||||
|
||||
# In case the cursor is not at the end of the line,
|
||||
# $cur consists of spaces that we want do remove.
|
||||
# For example: `nmcli connection modify id <TAB> lo`
|
||||
if [[ "$cur" =~ [[:space:]]+ ]]; then
|
||||
cur=''
|
||||
fi
|
||||
|
||||
_nmcli_complete_OPTIONS && return 0
|
||||
|
||||
local command="${words[1]}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue