Skip to content

Instantly share code, notes, and snippets.

@roalcantara
Forked from h14i/_direnv
Last active June 6, 2021 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roalcantara/54b967254d86de211f48e21017eccb4f to your computer and use it in GitHub Desktop.
Save roalcantara/54b967254d86de211f48e21017eccb4f to your computer and use it in GitHub Desktop.
direnv sub-commands completion for zsh. inspired https://gist.github.com/yonchu/5005758
#!/bin/zsh
#compdef direnv
# setopt -eu
function _direnv {
# https://gist.github.com/h14i/9183369
local direnv
local -a comp_list
direnv="\
allow[Grants direnv to load the given .envrc]
deny[Revokes the authorization of a given .envrc]
edit[Opens PATH_TO_RC or the current .envrc into an $EDITOR and allow the file to be loaded afterwards.]
exec[Executes a DIR COMMAND after loading the first .envrc found in DIR]
fetchurl[Fetches a given <url> into direnv's CAS]
help[shows this help]
hook[Used to setup the SHELL hook]
prune[removes old allowed files]
reload[triggers an env reload]
status[prints some debug status information]
stdlib[Displays the stdlib available in the .envrc execution context]
version[prints the version (2.28.0) or checks that direnv is older than VERSION_AT_LEAST.]"
comp_list=( ${(f)direnv} )
_values 'direnv subcmds' "$comp_list[@]"
}
_direnv "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment