mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-04-30 21:34:45 +00:00
Check completion for prefixes names.
If a name is a prefix of another word available for completion, adjust to show all words with given prefix. Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
This commit is contained in:
parent
83ca245532
commit
c227466673
@ -39,6 +39,7 @@ __lxc_check_name_present() {
|
|||||||
mapfile -t names < <(command lxc-ls -1)
|
mapfile -t names < <(command lxc-ls -1)
|
||||||
local -r shortoptnamexp="^-[0-9A-Za-mo-z]*n[0-9A-Za-mo-z]*$"
|
local -r shortoptnamexp="^-[0-9A-Za-mo-z]*n[0-9A-Za-mo-z]*$"
|
||||||
local parsed
|
local parsed
|
||||||
|
local -r current="${cur//[\\\"\']}"
|
||||||
mapfile -t names < <(command lxc-ls -1)
|
mapfile -t names < <(command lxc-ls -1)
|
||||||
# If `--name` or `-n` are present, do not complete with container names.
|
# If `--name` or `-n` are present, do not complete with container names.
|
||||||
for param in "${words[@]}"; do
|
for param in "${words[@]}"; do
|
||||||
@ -50,7 +51,9 @@ __lxc_check_name_present() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
for name in "${names[@]}"; do
|
for name in "${names[@]}"; do
|
||||||
[[ "${parsed}" == "${name}" ]] && return 0
|
if [[ "${parsed}" == "${name}" ]] && [[ "${current}" != "${parsed}" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user