The canonical-livepatch
snap does not feature autocompletion for its subcommands. As per the help page, the valid subcommands are:
$ canonical-livepatch help
...
COMMANDS:
config - configure livepatching on the machine
disable - disable livepatching on the machine
enable - enable livepatching on the machine
help - display help
kernel-upgrade-required - indicate whether a kernel upgrade is required
refresh - immediately download and apply any available livepatch
status - show kernel's livepatch status
Is there an easy way to add autocompletion for the subcommands in the canonical-livepatch
snap that works in Bash, without having to modify the snap itself?
A little detail is that the autocompletion should also work for the snap alias livepatch
I have for the command.
$ snap aliases
Command Alias Notes
canonical-livepatch livepatch manual
lxd.lxc lxc -
This can be done by creating the following autocompletion script (I've called it
livepatch-completion
):Place the script anywhere you like (for instance
~/.bash_completion
).Source the autocompletion script by adding this line to your
~/.bashrc
(or any other file that is sourced when you start the terminal):This may not be the most advanced solution, but it works for simply autocompleting the subcommands for any other command, including snaps and aliases.