bash completion for pct & qm

mo_

Member
Oct 27, 2011
399
3
18
Germany
Hi,

I came across something odd while trying to migrate VMs & CTs to 4.0 with backup & restore. I noticed how both "pct restore" and qmrestore dont seem to auto complete paths if you tab. Like "pct restore 12345 /var/li<TAB>" does nothing but hang the shell for a second or so. However if you do
Code:
alias pc="pct restore"
... bash completion for paths works just fine with the alias. There don't seem to be any rules for those particular binaries in /etc/bash_completion.d which made me wonder... is there another place where rules for those files might be defined? I've never actually worked with custom bash completions before so I might be missing something integral, but I'm not sure what that might be.

PS: Just upgraded, same behaviour in 4.1.
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
2,132
327
103
South Tyrol/Italy
The completions reside in:
Code:
/usr/share/bash-completion/completions/
FYI. And yes the completion is not perfect yet, but you could try to change the configs file to match:

Code:
[...]
complete -o default -C 'pct bashcomplete' pct
Note the added -o default, save it and source the file again.

I did not see any drawbacks of adding this yet, if you also could test it and report back would be nice.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE and Proxmox Mail Gateway. We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!