summaryrefslogtreecommitdiff
path: root/.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh
diff options
context:
space:
mode:
authorPedro Pereira <pedro.hr.pereira@proton.me>2026-10-16 15:19:13 -0300
committerPedro Pereira <pedro.hr.pereira@proton.me>2026-10-16 15:19:13 -0300
commit1eb69e9a795cc19450178c07d8d382622bc7ad70 (patch)
treeb6bc60605044fe929986f31b3b6bf4fee9b56e14 /.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh
first commit
Diffstat (limited to '.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh')
-rw-r--r--.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh26
1 files changed, 26 insertions, 0 deletions
diff --git a/.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh b/.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh
new file mode 100644
index 0000000..a6a0742
--- /dev/null
+++ b/.config/zsh/oh-my-zsh/plugins/lxd/lxd.plugin.zsh
@@ -0,0 +1,26 @@
+_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