-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy path_clarinet
More file actions
233 lines (226 loc) · 7.04 KB
/
_clarinet
File metadata and controls
233 lines (226 loc) · 7.04 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#compdef clarinet
autoload -U is-at-least
_clarinet() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'--help[Print help information]' \
'--version[Print version information]' \
":: :_clarinet_commands" \
"*::: :->clarinet" \
&& ret=0
case $state in
(clarinet)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:clarinet-command-$line[1]:"
case $line[1] in
(new)
_arguments "${_arguments_options[@]}" \
'--help[Print help information]' \
'--version[Print version information]' \
'--disable-telemetry[Do not provide developer usage telemetry for this project]' \
':name -- Project'\''s name:' \
&& ret=0
;;
(contract)
_arguments "${_arguments_options[@]}" \
'--help[Print help information]' \
'--version[Print version information]' \
":: :_contract_commands" \
"*::: :->contract" \
&& ret=0
case $state in
(contract)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:contract-command-$line[1]:"
case $line[1] in
(new)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
':name -- Contract'\''s name:' \
&& ret=0
;;
(requirement)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
':contract-id -- Contract id (ex. " SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait"):' \
&& ret=0
;;
(fork)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
':contract-id -- Contract id (ex. " SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait"):' \
&& ret=0
;;
esac
;;
esac
;;
(console)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
&& ret=0
;;
(test)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
'--coverage[Generate coverage file (coverage.lcov)]' \
'--costs[Generate costs report]' \
'--watch[Relaunch tests upon updates to contracts]' \
'*::files -- Test files to be included (defaults to all tests found under tests/):' \
&& ret=0
;;
(check)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
'::file -- If specified, check this file:' \
&& ret=0
;;
(publish)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
'(--testnet --mainnet)--devnet[Deploy contracts on devnet, using settings/Devnet.toml]' \
'(--devnet --mainnet)--testnet[Deploy contracts on testnet, using settings/Testnet.toml]' \
'(--testnet --devnet)--mainnet[Deploy contracts on mainnet, using settings/Mainnet.toml]' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
'--allow-wallets[Allow access to wallets]' \
'--allow-write[Allow write access to disk]' \
'--allow-read[Allow read access to disk]' \
':script -- Script to run:' \
&& ret=0
;;
(integrate)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
'--help[Print help information]' \
'--version[Print version information]' \
'--no-dashboard[Display streams of logs instead of terminal UI dashboard]' \
&& ret=0
;;
(lsp)
_arguments "${_arguments_options[@]}" \
'--help[Print help information]' \
'--version[Print version information]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'--help[Print help information]' \
'--version[Print version information]' \
':shell -- Specify which shell to generation completions script for:(bash elvish fish powershell zsh)' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_clarinet_commands] )) ||
_clarinet_commands() {
local commands; commands=(
'new:Create and scaffold a new project' \
'contract:Subcommands for working with contracts' \
'console:Load contracts in a REPL for an interactive session' \
'test:Execute test suite' \
'check:Check syntax of your contracts' \
'publish:Publish contracts on chain' \
'run:Execute Clarinet extension' \
'integrate:Start devnet environment for integration testing' \
'lsp:Start an LSP server (for integration with editors)' \
'completions:Generate shell completions scripts' \
)
_describe -t commands 'clarinet commands' commands "$@"
}
(( $+functions[_check_commands] )) ||
_check_commands() {
local commands; commands=()
_describe -t commands 'check commands' commands "$@"
}
(( $+functions[_completions_commands] )) ||
_completions_commands() {
local commands; commands=()
_describe -t commands 'completions commands' commands "$@"
}
(( $+functions[_console_commands] )) ||
_console_commands() {
local commands; commands=()
_describe -t commands 'console commands' commands "$@"
}
(( $+functions[_contract_commands] )) ||
_contract_commands() {
local commands; commands=(
'new:Generate files and settings for a new contract' \
'requirement:Add third-party requirements to this project' \
'fork:Replicate a third-party contract into this project' \
)
_describe -t commands 'contract commands' commands "$@"
}
(( $+functions[_fork_commands] )) ||
_fork_commands() {
local commands; commands=()
_describe -t commands 'fork commands' commands "$@"
}
(( $+functions[_integrate_commands] )) ||
_integrate_commands() {
local commands; commands=()
_describe -t commands 'integrate commands' commands "$@"
}
(( $+functions[_lsp_commands] )) ||
_lsp_commands() {
local commands; commands=()
_describe -t commands 'lsp commands' commands "$@"
}
(( $+functions[_new_commands] )) ||
_new_commands() {
local commands; commands=()
_describe -t commands 'new commands' commands "$@"
}
(( $+functions[_publish_commands] )) ||
_publish_commands() {
local commands; commands=()
_describe -t commands 'publish commands' commands "$@"
}
(( $+functions[_requirement_commands] )) ||
_requirement_commands() {
local commands; commands=()
_describe -t commands 'requirement commands' commands "$@"
}
(( $+functions[_run_commands] )) ||
_run_commands() {
local commands; commands=()
_describe -t commands 'run commands' commands "$@"
}
(( $+functions[_test_commands] )) ||
_test_commands() {
local commands; commands=()
_describe -t commands 'test commands' commands "$@"
}
_clarinet "$@"