❮ ZI Annex – LinkBin ❯

❮ ZI ❯ Annex – LinkBin

Run programs and scripts without adding anything to $PATH via the automated links to $ZPFX/bin

z.digitalclouds.dev | GitHub | Discussions | Localize

Install

zi light z-shell/z-a-linkbin


This content originally appeared on DEV Community and was authored by ❮ ZI ❯

❮ ZI ❯ Annex - LinkBin

Run programs and scripts without adding anything to $PATH via the automated links to $ZPFX/bin

eval preview

z.digitalclouds.dev | GitHub | Discussions | Localize

Install

zi light z-shell/z-a-linkbin

💡 Wiki

How it works

Exposing a binary program without modifying $PATHz-a-linkbin will automatically create a hard or soft link to the binary in $ZPFX/bin exposing the program to the command line as if it were being placed in $PATH.

The command can then be accessed normally – not only in the live Zsh session, but also from any Zsh script.

The ice-modifier lbin'' provided by the annex creates links for binaries and scripts.

It creates the link that calls the actual binary.
The link is created always under the same, standard and single $PATH entry: $ZPFX/bin

The optional preceding ! flag means create a soft link instead of a hard link.

Example:

zi ice from'gh-r' lbin'!fzf'
zi load junegunn/fzf

Check the output:

ls -l $ZPFX/bin/ | awk '{print $(NF-2),$(NF-1),$NF}'
fzf --version

The ice can contain globs. It will expand these when searching for the binary.

Example:

zi ice from'gh-r' lbin'**fzf -> myfzf'
zi load junegunn/fzf

Check the output:

ls $ZPFX/bin
myfzf --version

The ice can be empty. It will then try to create the link:

  • trailing component of the id_as ice, e.g.: id_as'exts/git-my' → it will check if a file git-my exists and if yes, create the link git-my,
  • the plugin name, e.g.: for paulirish/git-open it'll check if a file git-open exists and if yes, create the link git-open,
  • trailing component of the snippet URL,
  • for any alphabetically first executable file.

Above also applies if just ! were passed.

This repository compatible with ZI.

Have the best and leave the rest!


This content originally appeared on DEV Community and was authored by ❮ ZI ❯


Print Share Comment Cite Upload Translate Updates
APA

❮ ZI ❯ | Sciencx (2022-04-09T15:57:45+00:00) ❮ ZI Annex – LinkBin ❯. Retrieved from https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/

MLA
" » ❮ ZI Annex – LinkBin ❯." ❮ ZI ❯ | Sciencx - Saturday April 9, 2022, https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/
HARVARD
❮ ZI ❯ | Sciencx Saturday April 9, 2022 » ❮ ZI Annex – LinkBin ❯., viewed ,<https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/>
VANCOUVER
❮ ZI ❯ | Sciencx - » ❮ ZI Annex – LinkBin ❯. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/
CHICAGO
" » ❮ ZI Annex – LinkBin ❯." ❮ ZI ❯ | Sciencx - Accessed . https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/
IEEE
" » ❮ ZI Annex – LinkBin ❯." ❮ ZI ❯ | Sciencx [Online]. Available: https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/. [Accessed: ]
rf:citation
» ❮ ZI Annex – LinkBin ❯ | ❮ ZI ❯ | Sciencx | https://www.scien.cx/2022/04/09/%e2%9d%ae-zi-annex-linkbin-%e2%9d%af/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.