my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
548 B

3 years ago
  1. _lxc_get_command_list () {
  2. $_comp_command1 | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
  3. }
  4. _lxc_get_subcommand_list () {
  5. $_comp_command1 ${words[2]} | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
  6. }
  7. _lxc () {
  8. local curcontext="$curcontext" state line
  9. typeset -A opt_args
  10. _arguments \
  11. '1: :->command'\
  12. '*: :->args'
  13. case $state in
  14. command)
  15. compadd $(_lxc_get_command_list)
  16. ;;
  17. *)
  18. compadd $(_lxc_get_subcommand_list)
  19. ;;
  20. esac
  21. }
  22. compdef _lxc lxc