You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: website/content/en/docs/usage/_index.md
-55Lines changed: 0 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,61 +72,6 @@ Then you can connect directly:
72
72
ssh lima-default
73
73
```
74
74
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
-
130
75
### Shell completion
131
76
- To enable bash completion, add `source <(limactl completion bash)` to `~/.bash_profile`.
132
77
- To enable zsh completion, see `limactl completion zsh --help`
0 commit comments