canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

Tab Complete Options for "lxc project ..." #6912

Closed 66hades closed 4 years ago

66hades commented 4 years ago

Issue description

When executing the command "lxc project ..." no function arguments appear when using tab complete, only the contents of the pwd.

For example, executing lxc config then hitting tab produces

gardener6@borderbound3:~$ lxc config
device    edit      get       metadata  set       show      template  trust     unset
gardener6@borderbound3:~$ lxc config

and executing lxc restart will produce a list of containers (only containers that are in the current project)

I poked around trying to find a fix myself. This stackflow entry says using compgen or complete, but a brief look around LXD source code didn't net me any results. Could someone point me in the direction where this is implemented in existing lxd functions?

Steps to reproduce

  1. Type lxc project
  2. Press the tab key

Results of steps

gardener6@borderbound3:~/minecraft_files/Paper-ver-1.14$ lxc project
CONTRIBUTING.md        .gitignore             licenses/              README.md              Spigot-API-Patches/    work/
.editorconfig          .gitmodules            paper                  removed/               Spigot-Server-Patches/
.github/               LICENSE.md             pom.xml                scripts/               .travis.yml
gardener6@borderbound3:~/minecraft_files/Paper-ver-1.14$ lxc project

Required information

Information to attach

66hades commented 4 years ago

I think I found where the problem is, in the bash script for lxd-client. I'm confident I can fix this over the weekend 😊

stgraber commented 4 years ago

Cool, a PR would be quite welcome.

It should indeed be pretty straightforward to add that subcommand to scripts/bash/lxd-client.