has
Summary
Section titled “Summary”has'' loads a plugin or snippet only when the specified command is available in
$PATH. It is a convenience shorthand for a common if'' pattern.
Syntax / Usage
Section titled “Syntax / Usage”zi ice has"git"zi ice has"docker"Details
Section titled “Details”The value is a command name. Zinit checks $PATH for its existence at load time. If
the command is not found, the plugin is skipped.
has'' is equivalent to if'(( $+commands[<cmd>] ))' but more readable.
Works with both plugins and snippets.
Examples
Section titled “Examples”# Load git-related helpers only when git is installedzi ice has"git" wait lucidzi light user/git-helpers
# Load kubectl completion only when kubectl is availablezi ice has"kubectl" as"completion"zi snippet https://raw.githubusercontent.com/.../kubectl_completion.zshSee Also
Section titled “See Also”- if
- load