Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
A new Zplugin extension that exposes binaries
- X-seq: zsh-users 24263
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: A new Zplugin extension that exposes binaries
- Date: Thu, 19 Sep 2019 00:27:30 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=6BV0InM71LGaxA64c8BJXzr5IP+5cg0k6Jlcx910q3Y=; b=bGkC/9PM3ecMORhrlEmXaP8+r+BjgVpxLwGC5yEVwJQhW+g7ohWOWsLjf9ho3n8RPM MeCwO7YKY3hx8pZ7t5eTsVJb4QvJBw4LvFb7bJR9CVhpiXVydGeyj8wdKKX3mFE7dvOP 68FVwzN+JtcFYtBF7kCqmY9IBV8aJiVmhaUm7cwbckEEttoJg612JDvOOkc+DY9RqJZ0 kElP9PYVdXR7cujS3BMfGtJkGOWqxWw1DtlCY9eCjSZRqKP/pGgIUpqGz9w9WafjElgt Y5BYGbcJuuUv6A+SmoBMPqezEh1YVLM3+NH0++fpS7WWa1AV0ZRV7XGbJkJqC93gOnA3 VOOg==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hello,
normally, when one wants to gain access to execute a script/program,
he copies it to the PATH or adds its directory to the PATH. There is
however a different method: to create a function of the same name as
the binary with the path to it embedded inside the function.
One other method is to create a "forwarder"-script (rbenv calls such
scripts `shims') and copy it to the single, possibly dedicated PATH
entry.
The zplugin extension does this automatically. Example function created:
asciidoctor () {
local bindir="/home/sg/.zplugin/plugins/zdharma---null/bin"
local -x GEM_HOME="/home/sg/.zplugin/plugins/zdharma---null"
"$bindir"/"asciidoctor" "$@"
}
As it can be seen the extension can also install gems and
automatically export GEM_HOME (plus the same for Node, and some other
features).
You can check it out at:
https://github.com/zplugin/z-a-bin-gem-node
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author