File: External-Commands.md

package info (click to toggle)
zplug 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,068 kB
  • sloc: sh: 1,504; awk: 235; makefile: 26
file content (46 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# External Commands

zplug, like `git(1)`, supports external commands.
This lets you create new commands that can be run like:

```console
$ zplug mycommand --option1 --option2 package
```

without modifying zplug's internals.

## How to write commands

As long as the external command is executable (`chmod +x`) and live somewhere in `$PATH`,
any language will do (e.g. shell script, ruby script, etc.).

Example:

```zsh
#!/usr/bin/env zsh
# description: my new zplug command

echo "Hello, zplug"
```

when saving as zplug-foo, the command can be invoked like zplug foo.
In addition, the description line (line 2) is used as the description
in the completion.

```console
% zplug
Completing zplug commands
check    --> Check whether an update or installation is available
clean    --> Remove deprecated repositories
clear    --> Remove cache file
foo      --> [User-defined] my new zplug command
install  --> Install described items (plugins/commands) in parallel
list     --> Show all of the zplugs in the current shell
load     --> Load installed items
status   --> Check if remote branch is up-to-date
update   --> Update items in parallel
```

## Sample script

- [zplug-env](../../bin/zplug-env)