Unverified Commit f742baf7 authored by Renato dos Santos's avatar Renato dos Santos Committed by GitHub
Browse files

Add plugin for LXD autocomplete (#7457)

parent 6b5c8728
# lxd
This plugin provides completion for [lxd](https://linuxcontainers.org/lxd/), as well as aliases
for frequent lxc commands.
To use it add `lxd` to the plugins array in your zshrc file.
```zsh
plugins=(... lxd)
_lxc_get_command_list () {
$_comp_command1 | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
}
_lxc_get_subcommand_list () {
$_comp_command1 ${words[2]} | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
}
_lxc () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->command'\
'*: :->args'
case $state in
command)
compadd $(_lxc_get_command_list)
;;
*)
compadd $(_lxc_get_subcommand_list)
;;
esac
}
compdef _lxc lxc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment