CLIHandler: consider valid prefixes for completion
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 30 Jul 2019 12:42:12 +0000 (14:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Aug 2019 09:13:06 +0000 (11:13 +0200)
commit6bd0783c11f72019ffe222f7088ba408fc407278
treeca707ef58ffca845711b0a1084cc0022ccb1102b
parent93e9f666abaa50fb19e565055d14fd3649b0f86f
CLIHandler: consider valid prefixes for completion

With the change introduced in 57c0d0c69c687f2dff876aa81369622d0ae0a841
completion of partial commands stopped working (e.g. typing qm res<TAB><TAB>
yields nothing instead of 'reset resize resume rescan')

By returning undef as 'ref' 'print_bash_completion' has no reference of the
available (sub) commands anymore.

By checking if the current argument is a valid prefix of a possible command,
and conditionally not setting the 'ref' hash to undef, the functionality is
restored.

Additionally a small whitespace glitch was fixed.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PVE/CLIHandler.pm