1+ # compdef direnv
2+ # ------------------------------------------------------------------------------
3+ # Redistribution and use in source and binary forms, with or without
4+ # modification, are permitted provided that the following conditions are met:
5+ # * Redistributions of source code must retain the above copyright
6+ # notice, this list of conditions and the following disclaimer.
7+ # * Redistributions in binary form must reproduce the above copyright
8+ # notice, this list of conditions and the following disclaimer in the
9+ # documentation and/or other materials provided with the distribution.
10+ # * Neither the name of the zsh-users nor the
11+ # names of its contributors may be used to endorse or promote products
12+ # derived from this software without specific prior written permission.
13+ #
14+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+ # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS OR THE AUTHOR BE LIABLE FOR ANY
18+ # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+ # ------------------------------------------------------------------------------
25+ # Description
26+ # -----------
27+ #
28+ # Completion script for direnv 2.34.0 (https://direnv.net/)
29+ #
30+ # ------------------------------------------------------------------------------
31+ # Authors
32+ # -------
33+ #
34+ # * Nitai J. Perez <youcangetselfish@gmail.com>
35+ #
36+ # ------------------------------------------------------------------------------
37+
38+ (( $+ functions[_direnv_commands] )) ||
39+ _direnv_commands () {
40+ local -a commands=(
41+ ' allow:Grants direnv permission to load the given .envrc or .env file'
42+ ' permit:Grants direnv permission to load the given .envrc or .env file'
43+ ' grant:Grants direnv permission to load the given .envrc or .env file'
44+ ' block:Revokes the authorization of a given .envrc or .env file'
45+ ' deny:Revokes the authorization of a given .envrc or .env file'
46+ ' revoke:Revokes the authorization of a given .envrc or .env file'
47+ ' edit:Opens PATH_TO_RC or the current .envrc or .env into an $EDITOR and allow the file to be loaded afterwards'
48+ ' exec:Executes a command after loading the first .envrc or .env found in DIR'
49+ " fetchurl:Fetches a given URL into direnv's CAS"
50+ ' help:shows this help'
51+ ' hook:Used to setup the shell hook'
52+ ' prune:removes old allowed files'
53+ ' reload:triggers an env reload'
54+ ' status:prints some debug status information'
55+ ' stdlib:Displays the stdlib available in the .envrc execution context'
56+ ' version:prints the version or checks that direnv is older than VERSION_AT_LEAST'
57+ )
58+
59+ _describe ' command' commands
60+ }
61+
62+ _direnv () {
63+ local curcontext=" $curcontext " state line
64+ typeset -A opt_args
65+ local ret=1
66+
67+ _arguments -C \
68+ ' 1: :_direnv_commands' \
69+ ' *:: :->command_args' && ret=0
70+
71+ case $state in
72+ (command_args)
73+ case $words [1] in
74+ (allow|permit|grant|block|deny|revoke|edit)
75+ _arguments \
76+ ' 1:rc file:_files' \
77+ && ret=0
78+ ;;
79+ (exec)
80+ _arguments \
81+ ' 1:directory:_files -/' \
82+ ' 2:command:_command_names' \
83+ && ret=0
84+ ;;
85+ (hook)
86+ _arguments \
87+ ' 1:shell:(bash zsh fish tcsh elvish)' \
88+ && ret=0
89+ ;;
90+ (fetchurl)
91+ _arguments \
92+ ' 1:url:_urls' \
93+ ' 2:integrity hash' \
94+ && ret=0
95+ ;;
96+ (status)
97+ _arguments \
98+ ' --json[print status information in JSON format]' \
99+ && ret=0
100+ ;;
101+ (version)
102+ _arguments \
103+ ' 1:version at least' \
104+ && ret=0
105+ ;;
106+ (help)
107+ _arguments \
108+ ' 1:show private:(SHOW_PRIVATE)' \
109+ && ret=0
110+ ;;
111+ (prune|reload|status|stdlib)
112+ # do not complete
113+ ret=0
114+ ;;
115+ (* )
116+ _default && ret=0
117+ ;;
118+ esac
119+ ;;
120+ esac
121+
122+ return ret
123+ }
124+
125+ _direnv " $@ "
126+
127+ # Local Variables:
128+ # mode: Shell-Script
129+ # sh-indentation: 2
130+ # indent-tabs-mode: nil
131+ # sh-basic-offset: 2
132+ # End:
133+ # vim: ft=zsh sw=2 ts=2 et
0 commit comments