Skip to content

Commit 652aa8d

Browse files
committed
feat(completions): add check/generate/apply subcommands for deployments
Closes #2050 This PR adds shell completions for the 'deployments' subcommand arguments: - check: Check a deployment plan - generate: Generate a deployment plan - apply: Apply a deployment plan Updated completion files: - clarinet.bash (Bash) - _clarinet (Zsh) - clarinet.fish (Fish) Each subcommand now includes appropriate options like --devnet, --testnet, --mainnet, and subcommand-specific flags like --low-cost for generate.
1 parent 438722e commit 652aa8d

File tree

3 files changed

+106
-14
lines changed

3 files changed

+106
-14
lines changed

components/clarinet-cli/completions/_clarinet

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,53 @@ _arguments "${_arguments_options[@]}" \
107107
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
108108
'--help[Print help information]' \
109109
'--version[Print version information]' \
110-
'(--testnet --mainnet)--devnet[Deploy contracts on devnet, using settings/Devnet.toml]' \
111-
'(--devnet --mainnet)--testnet[Deploy contracts on testnet, using settings/Testnet.toml]' \
112-
'(--testnet --devnet)--mainnet[Deploy contracts on mainnet, using settings/Mainnet.toml]' \
110+
":: :_deployments_commands" \
111+
"*::: :->deployments" \
112+
&& ret=0
113+
114+
case $state in
115+
(deployments)
116+
words=($line[1] "${words[@]}")
117+
(( CURRENT += 1 ))
118+
curcontext="${curcontext%:*:*}:deployments-command-$line[1]:"
119+
case $line[1] in
120+
(check)
121+
_arguments "${_arguments_options[@]}" \
122+
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
123+
'--help[Print help information]' \
124+
'--version[Print version information]' \
125+
'(--testnet --mainnet)--devnet[Check deployment plan for devnet]' \
126+
'(--devnet --mainnet)--testnet[Check deployment plan for testnet]' \
127+
'(--testnet --devnet)--mainnet[Check deployment plan for mainnet]' \
128+
&& ret=0
129+
;;
130+
(generate)
131+
_arguments "${_arguments_options[@]}" \
132+
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
133+
'--help[Print help information]' \
134+
'--version[Print version information]' \
135+
'(--testnet --mainnet)--devnet[Generate deployment plan for devnet]' \
136+
'(--devnet --mainnet)--testnet[Generate deployment plan for testnet]' \
137+
'(--testnet --devnet)--mainnet[Generate deployment plan for mainnet]' \
138+
'--low-cost[Use low cost settings]' \
139+
'--medium-cost[Use medium cost settings]' \
140+
'--manual-cost[Set transaction costs manually]' \
141+
&& ret=0
142+
;;
143+
(apply)
144+
_arguments "${_arguments_options[@]}" \
145+
'--manifest-path=[Path to Clarinet.toml]:MANIFEST_PATH: ' \
146+
'--help[Print help information]' \
147+
'--version[Print version information]' \
148+
'(--testnet --mainnet)--devnet[Apply deployment plan for devnet]' \
149+
'(--devnet --mainnet)--testnet[Apply deployment plan for testnet]' \
150+
'(--testnet --devnet)--mainnet[Apply deployment plan for mainnet]' \
151+
'--no-dashboard[Display streams of logs instead of terminal UI dashboard]' \
113152
&& ret=0
153+
;;
154+
esac
155+
;;
156+
esac
114157
;;
115158
(run)
116159
_arguments "${_arguments_options[@]}" \
@@ -211,7 +254,11 @@ _new_commands() {
211254
}
212255
(( $+functions[_deployments_commands] )) ||
213256
_deployments_commands() {
214-
local commands; commands=()
257+
local commands; commands=(
258+
'check:Check a deployment plan' \
259+
'generate:Generate a deployment plan' \
260+
'apply:Apply a deployment plan' \
261+
)
215262
_describe -t commands 'deployments commands' commands "$@"
216263
}
217264
(( $+functions[_requirement_commands] )) ||

components/clarinet-cli/completions/clarinet.bash

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ _clarinet() {
3939
deployments)
4040
cmd+="__deployments"
4141
;;
42+
apply)
43+
cmd+="__apply"
44+
;;
45+
generate)
46+
cmd+="__generate"
47+
;;
4248
requirement)
4349
cmd+="__requirement"
4450
;;
@@ -194,17 +200,34 @@ _clarinet() {
194200
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
195201
return 0
196202
;;
197-
deployments)
198-
opts="--help --version new contract console test check deployments run integrate lsp completions"
199-
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
203+
clarinet__deployments)
204+
opts="--help --version --manifest-path check generate apply"
205+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
200206
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
201207
return 0
202208
fi
203209
case "${prev}" in
204-
*)
210+
--manifest-path)
205211
COMPREPLY=()
206212
;;
213+
*)
214+
COMPREPLY=( $(compgen -W "check generate apply" -- "${cur}") )
215+
;;
207216
esac
217+
return 0
218+
;;
219+
clarinet__deployments__check)
220+
opts="--help --version --manifest-path --devnet --testnet --mainnet"
221+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
222+
return 0
223+
;;
224+
clarinet__deployments__generate)
225+
opts="--help --version --manifest-path --devnet --testnet --mainnet --low-cost --medium-cost --manual-cost"
226+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
227+
return 0
228+
;;
229+
clarinet__deployments__apply)
230+
opts="--help --version --manifest-path --devnet --testnet --mainnet --no-dashboard"
208231
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
209232
return 0
210233
;;

components/clarinet-cli/completions/clarinet.fish

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,34 @@ complete -c clarinet -n "__fish_seen_subcommand_from test" -l watch -d 'Relaunch
3939
complete -c clarinet -n "__fish_seen_subcommand_from check" -l manifest-path -d 'Path to Clarinet.toml' -r
4040
complete -c clarinet -n "__fish_seen_subcommand_from check" -l help -d 'Print help information'
4141
complete -c clarinet -n "__fish_seen_subcommand_from check" -l version -d 'Print version information'
42-
complete -c clarinet -n "__fish_seen_subcommand_from deployments" -l manifest-path -d 'Path to Clarinet.toml' -r
43-
complete -c clarinet -n "__fish_seen_subcommand_from deployments" -l help -d 'Print help information'
44-
complete -c clarinet -n "__fish_seen_subcommand_from deployments" -l version -d 'Print version information'
45-
complete -c clarinet -n "__fish_seen_subcommand_from deployments" -l devnet -d 'Deploy contracts on devnet, using settings/Devnet.toml'
46-
complete -c clarinet -n "__fish_seen_subcommand_from deployments" -l testnet -d 'Deploy contracts on testnet, using settings/Testnet.toml'
47-
complete -c clarinet -n "__fish_seen_subcommand_from deployments" -l mainnet -d 'Deploy contracts on mainnet, using settings/Mainnet.toml'
42+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and not __fish_seen_subcommand_from check; and not __fish_seen_subcommand_from generate; and not __fish_seen_subcommand_from apply" -l manifest-path -d 'Path to Clarinet.toml' -r
43+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and not __fish_seen_subcommand_from check; and not __fish_seen_subcommand_from generate; and not __fish_seen_subcommand_from apply" -l help -d 'Print help information'
44+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and not __fish_seen_subcommand_from check; and not __fish_seen_subcommand_from generate; and not __fish_seen_subcommand_from apply" -l version -d 'Print version information'
45+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and not __fish_seen_subcommand_from check; and not __fish_seen_subcommand_from generate; and not __fish_seen_subcommand_from apply" -f -a "check" -d 'Check a deployment plan'
46+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and not __fish_seen_subcommand_from check; and not __fish_seen_subcommand_from generate; and not __fish_seen_subcommand_from apply" -f -a "generate" -d 'Generate a deployment plan'
47+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and not __fish_seen_subcommand_from check; and not __fish_seen_subcommand_from generate; and not __fish_seen_subcommand_from apply" -f -a "apply" -d 'Apply a deployment plan'
48+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from check" -l manifest-path -d 'Path to Clarinet.toml' -r
49+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from check" -l help -d 'Print help information'
50+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from check" -l version -d 'Print version information'
51+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from check" -l devnet -d 'Check deployment plan for devnet'
52+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from check" -l testnet -d 'Check deployment plan for testnet'
53+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from check" -l mainnet -d 'Check deployment plan for mainnet'
54+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l manifest-path -d 'Path to Clarinet.toml' -r
55+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l help -d 'Print help information'
56+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l version -d 'Print version information'
57+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l devnet -d 'Generate deployment plan for devnet'
58+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l testnet -d 'Generate deployment plan for testnet'
59+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l mainnet -d 'Generate deployment plan for mainnet'
60+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l low-cost -d 'Use low cost settings'
61+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l medium-cost -d 'Use medium cost settings'
62+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from generate" -l manual-cost -d 'Set transaction costs manually'
63+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l manifest-path -d 'Path to Clarinet.toml' -r
64+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l help -d 'Print help information'
65+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l version -d 'Print version information'
66+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l devnet -d 'Apply deployment plan for devnet'
67+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l testnet -d 'Apply deployment plan for testnet'
68+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l mainnet -d 'Apply deployment plan for mainnet'
69+
complete -c clarinet -n "__fish_seen_subcommand_from deployments; and __fish_seen_subcommand_from apply" -l no-dashboard -d 'Display streams of logs instead of terminal UI dashboard'
4870
complete -c clarinet -n "__fish_seen_subcommand_from run" -l manifest-path -d 'Path to Clarinet.toml' -r
4971
complete -c clarinet -n "__fish_seen_subcommand_from run" -l help -d 'Print help information'
5072
complete -c clarinet -n "__fish_seen_subcommand_from run" -l version -d 'Print version information'

0 commit comments

Comments
 (0)