-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuidler-zsh.plugin.zsh
executable file
·119 lines (108 loc) · 3.83 KB
/
buidler-zsh.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# zsh completion for buidler (https://buidler.dev/)
#
# version: 0.1.0
# github: https://github.com/gonzalobellino/buidler-zsh
#
# license:
#
#MIT License
#
#Copyright (c) 2020 gonzalobellino
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
##copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
#
#autoload
#zstyle ':completion:*:*:buidler:*' option-stacking yes
buidler() {
echo "run npx --no-install buidler..."
npx --no-install buidler "$@"
}
__bdldr_complete() {
local -a _1st_arguments
local context state line curcontext="$curcontext"
_1st_arguments=(
'accounts:Prints the list of accounts'
'clean:Clears the cache and deletes all artifacts'
'compile:Compiles the entire project, building all artifacts'
'console:Opens a buidler console'
'flatten:Flattens and prints all contracts and their dependencies'
'help:Prints this message'
'node:Starts a JSON-RPC server on top of Buidler EVM'
'run:Runs a user-defined script after compiling the project'
'test:Runs mocha tests:'
)
_arguments -C \
'(--config)--config[A Buidler config file.]:file:_files -g \*.\(js\|ts\)' \
'(--emoji)--emoji[Use emoji in messages.]' \
'(--help)--help[Shows this message, or a tasks help if its name is provided]' \
'(--max-memory)--max-memory[The maximum amount of memory that Buidler can use.]:int:' \
'--network[The network to connect to.]:The network to connect to.:(localhost robsten kovan)' \
'(--show-stack-traces)--show-stack-traces[Show stack traces.]' \
'(--verbose)--verbose[Enables Buidler verbose logging]' \
'(--version)--version[Shows buidler version.]:' \
'1:: :->cmds' \
'2:: :->subcmds' \
'3:: :->subsubcmds' \
&& return 0
case "$state" in
(cmds)
_describe -t commands "buidler commands" _1st_arguments
return 0
;;
(subcmds)
case "$line[1]" in
(accounts|clean|flatten)
;;
(compile)
_values 'compile' '--force' && ret=0;
;;
(console)
_values 'console' '*--no-compile' && ret=0;
;;
(node)
_values 'node' '--hostname' && ret=0;
;;
(run|test)
_values 'run' "--no-compile[Don't compile before running this task]"
_arguments '*:file:_files -g \*.\(js\|ts\)' && ret=0;
;;
esac
;;
(subsubcmds)
case "$line[1]" in
(node)
_values 'node' '--port' && ret=0;
;;
(run|test)
_arguments '*:file:_files -g \*.\(js\|ts\)' && ret=0;
;;
(compile|console)
;;
esac
;;
esac
return
}
compdef __bdldr_complete buidler
alias buid="npx --no-install buidler"
alias buidc="npx --no-install buidler compile"
alias buidt="npx --no-install buidler test"
alias buidr="npx --no-install buidler run"
alias buidn="npx --no-install buidler node"
alias buidh="npx --no-install buidler help"