From 4ee0cf3cb4c64568430f9af5b1edca2602ab5807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Civan=20Yavuz=C5=9Fen?= Date: Tue, 1 Feb 2022 23:48:14 +0100 Subject: [PATCH] feat(multipass): add plugin for multipass (#10140) Co-authored-by: C. Yavuzsen --- plugins/multipass/README.md | 22 ++++++++ plugins/multipass/_multipass | 73 ++++++++++++++++++++++++++ plugins/multipass/multipass.plugin.zsh | 7 +++ 3 files changed, 102 insertions(+) create mode 100644 plugins/multipass/README.md create mode 100644 plugins/multipass/_multipass create mode 100644 plugins/multipass/multipass.plugin.zsh diff --git a/plugins/multipass/README.md b/plugins/multipass/README.md new file mode 100644 index 000000000..f6b2d76f4 --- /dev/null +++ b/plugins/multipass/README.md @@ -0,0 +1,22 @@ +# multipass + +This plugin provides completion for [multipass](https://multipass.run), as well as aliases +for multipass commands. + +To use it, add `multipass` to the plugins array in your zshrc file: + +```zsh +plugins=(... multipass) +``` + +## Aliases + +| Alias | Command | +| ------ | ------------------------------------------------------------------- | +| `mp` | `multipass` | +| `mpl` | `multipass list` | +| `mpla` | `multipass launch` | +| `mpln` | `multipass launch --network en0 --network name=bridge0,mode=manual` | +| `mps` | `multipass shell` | +| `mpsp` | `multipass stop` | +| `mpst` | `multipass start` | diff --git a/plugins/multipass/_multipass b/plugins/multipass/_multipass new file mode 100644 index 000000000..c742df650 --- /dev/null +++ b/plugins/multipass/_multipass @@ -0,0 +1,73 @@ +#compdef multipass + +_multipass_get_command_list () { + # Sample output: + # $ multipass --help + # ... + # Options: + # -h, --help Display this help + # -v, --verbose Increase logging verbosity. Repeat the 'v' in the short option + # for more detail. Maximum verbosity is obtained with 4 (or more) + # v's, i.e. -vvvv. + # ... + # Available commands: + # alias Create an alias + # aliases List available aliases + # ... + # + $_comp_command1 --help | sed '1,/Available commands/d' | awk '/^[ \t]*[a-z]+/ { print $1 }' +} + +_multipass_get_args_list () { + # Sample output: + # $ multpass help stop + # ... + # Options: + # -h, --help Display this help + # -v, --verbose Increase logging verbosity. Repeat the 'v' in the short + # option for more detail. Maximum verbosity is obtained with + # 4 (or more) v's, i.e. -vvvv. + # --all Stop all instances + # -t, --time