Skip to content

Commit 4515389

Browse files
committed
docs: move CLI plugin docs from usage to config/plugins
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent 37a0ad8 commit 4515389

File tree

4 files changed

+71
-55
lines changed

4 files changed

+71
-55
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Plugins
3+
weight: 90
4+
---
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: CLI plugins
3+
weight: 2
4+
---
5+
6+
| ⚡ Requirement | Lima >= 2.0 |
7+
|----------------|-------------|
8+
9+
Lima supports a plugin-like command aliasing system similar to `git`, `kubectl`, and `docker`. When you run a `limactl` command that doesn't exist, Lima will automatically look for an external program named `limactl-<command>` in your system's PATH.
10+
11+
## Creating Custom Aliases
12+
13+
To create a custom alias, create an executable script with the name `limactl-<alias>` and place it somewhere in your PATH.
14+
15+
**Example: Creating a `ps` alias for listing instances**
16+
17+
1. Create a script called `limactl-ps`:
18+
```bash
19+
#!/bin/sh
20+
# Show instances in a compact format
21+
limactl list --format table "$@"
22+
```
23+
24+
2. Make it executable and place it in your PATH:
25+
```bash
26+
chmod +x limactl-ps
27+
sudo mv limactl-ps /usr/local/bin/
28+
```
29+
30+
3. Now you can use it:
31+
```bash
32+
limactl ps # Shows instances in table format
33+
limactl ps --quiet # Shows only instance names
34+
```
35+
36+
**Example: Creating an `sh` alias**
37+
38+
```bash
39+
#!/bin/sh
40+
# limactl-sh - Connect to an instance shell
41+
limactl shell "$@"
42+
```
43+
44+
After creating this alias:
45+
```bash
46+
limactl sh default # Equivalent to: limactl shell default
47+
limactl sh myinstance bash # Equivalent to: limactl shell myinstance bash
48+
```
49+
50+
## How It Works
51+
52+
1. When you run `limactl <unknown-command>`, Lima first tries to find a built-in command
53+
2. If no built-in command is found, Lima searches for `limactl-<unknown-command>` in your PATH
54+
3. If found, Lima executes the external program and passes all remaining arguments to it
55+
4. If not found, Lima shows the standard "unknown command" error
56+
57+
This system allows you to:
58+
- Create personal shortcuts and aliases
59+
- Extend Lima's functionality without modifying the core application
60+
- Share custom commands with your team by distributing scripts
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: VM driver plugins
3+
weight: 1
4+
---
5+
6+
See [Virtual Machine Drivers](../../dev/drivers.md).
7+
<!-- TODO: migrate the most of the content from ../../dev/drivers.md to here -->

website/content/en/docs/usage/_index.md

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -72,61 +72,6 @@ Then you can connect directly:
7272
ssh lima-default
7373
```
7474

75-
### Command Aliasing (Plugin System)
76-
77-
Lima supports a plugin-like command aliasing system similar to `git`, `kubectl`, and `docker`. When you run a `limactl` command that doesn't exist, Lima will automatically look for an external program named `limactl-<command>` in your system's PATH.
78-
79-
#### Creating Custom Aliases
80-
81-
To create a custom alias, create an executable script with the name `limactl-<alias>` and place it somewhere in your PATH.
82-
83-
**Example: Creating a `ps` alias for listing instances**
84-
85-
1. Create a script called `limactl-ps`:
86-
```bash
87-
#!/bin/sh
88-
# Show instances in a compact format
89-
limactl list --format table "$@"
90-
```
91-
92-
2. Make it executable and place it in your PATH:
93-
```bash
94-
chmod +x limactl-ps
95-
sudo mv limactl-ps /usr/local/bin/
96-
```
97-
98-
3. Now you can use it:
99-
```bash
100-
limactl ps # Shows instances in table format
101-
limactl ps --quiet # Shows only instance names
102-
```
103-
104-
**Example: Creating an `sh` alias**
105-
106-
```bash
107-
#!/bin/sh
108-
# limactl-sh - Connect to an instance shell
109-
limactl shell "$@"
110-
```
111-
112-
After creating this alias:
113-
```bash
114-
limactl sh default # Equivalent to: limactl shell default
115-
limactl sh myinstance bash # Equivalent to: limactl shell myinstance bash
116-
```
117-
118-
#### How It Works
119-
120-
1. When you run `limactl <unknown-command>`, Lima first tries to find a built-in command
121-
2. If no built-in command is found, Lima searches for `limactl-<unknown-command>` in your PATH
122-
3. If found, Lima executes the external program and passes all remaining arguments to it
123-
4. If not found, Lima shows the standard "unknown command" error
124-
125-
This system allows you to:
126-
- Create personal shortcuts and aliases
127-
- Extend Lima's functionality without modifying the core application
128-
- Share custom commands with your team by distributing scripts
129-
13075
### Shell completion
13176
- To enable bash completion, add `source <(limactl completion bash)` to `~/.bash_profile`.
13277
- To enable zsh completion, see `limactl completion zsh --help`

0 commit comments

Comments
 (0)