@@ -8,6 +8,7 @@ use spin_cli::commands::{
8
8
cloud:: { DeployCommand , LoginCommand } ,
9
9
doctor:: DoctorCommand ,
10
10
external:: execute_external_subcommand,
11
+ generate_completions:: GenerateCompletionsCommand ,
11
12
new:: { AddCommand , NewCommand } ,
12
13
plugins:: PluginCommands ,
13
14
registry:: RegistryCommands ,
@@ -129,8 +130,8 @@ enum SpinApp {
129
130
Plugins ( PluginCommands ) ,
130
131
#[ clap( subcommand, hide = true ) ]
131
132
Trigger ( TriggerCommands ) ,
132
- #[ clap( hide = true , name = "generate-bash- completions" ) ]
133
- GenerateBashCompletions ,
133
+ #[ clap( hide = true , name = "generate-completions" ) ]
134
+ GenerateCompletions ( GenerateCompletionsCommand ) ,
134
135
#[ clap( external_subcommand) ]
135
136
External ( Vec < String > ) ,
136
137
Watch ( WatchCommand ) ,
@@ -164,11 +165,7 @@ impl SpinApp {
164
165
Self :: External ( cmd) => execute_external_subcommand ( cmd, app) . await ,
165
166
Self :: Watch ( cmd) => cmd. run ( ) . await ,
166
167
Self :: Doctor ( cmd) => cmd. run ( ) . await ,
167
- Self :: GenerateBashCompletions => {
168
- let mut cmd: clap:: Command = SpinApp :: into_app ( ) ;
169
- print_completions ( clap_complete:: Shell :: Bash , & mut cmd) ;
170
- Ok ( ( ) )
171
- }
168
+ Self :: GenerateCompletions ( cmd) => cmd. run ( SpinApp :: into_app ( ) ) . await ,
172
169
}
173
170
}
174
171
}
@@ -227,7 +224,3 @@ fn installed_plugin_help_entries() -> Vec<PluginHelpEntry> {
227
224
fn hide_plugin_in_help ( plugin : & spin_plugins:: manifest:: PluginManifest ) -> bool {
228
225
plugin. name ( ) . starts_with ( "trigger-" )
229
226
}
230
-
231
- fn print_completions < G : clap_complete:: Generator > ( gen : G , cmd : & mut clap:: Command ) {
232
- clap_complete:: generate ( gen, cmd, cmd. get_name ( ) . to_string ( ) , & mut std:: io:: stdout ( ) )
233
- }
0 commit comments