@@ -7,6 +7,7 @@ use spin_cli::commands::{
7
7
build:: BuildCommand ,
8
8
deploy:: DeployCommand ,
9
9
external:: execute_external_subcommand,
10
+ generate_completions:: GenerateCompletionsCommand ,
10
11
login:: LoginCommand ,
11
12
new:: { AddCommand , NewCommand } ,
12
13
plugins:: PluginCommands ,
@@ -57,8 +58,8 @@ enum SpinApp {
57
58
Plugin ( PluginCommands ) ,
58
59
#[ clap( subcommand, hide = true ) ]
59
60
Trigger ( TriggerCommands ) ,
60
- #[ clap( hide = true , name = "generate-bash- completions" ) ]
61
- GenerateBashCompletions ,
61
+ #[ clap( hide = true , name = "generate-completions" ) ]
62
+ GenerateCompletions ( GenerateCompletionsCommand ) ,
62
63
#[ clap( external_subcommand) ]
63
64
External ( Vec < String > ) ,
64
65
}
@@ -84,11 +85,7 @@ impl SpinApp {
84
85
Self :: Trigger ( TriggerCommands :: Redis ( cmd) ) => cmd. run ( ) . await ,
85
86
Self :: Login ( cmd) => cmd. run ( ) . await ,
86
87
Self :: Plugin ( cmd) => cmd. run ( ) . await ,
87
- Self :: GenerateBashCompletions => {
88
- let mut cmd: clap:: Command = SpinApp :: into_app ( ) ;
89
- print_completions ( clap_complete:: Shell :: Bash , & mut cmd) ;
90
- Ok ( ( ) )
91
- }
88
+ Self :: GenerateCompletions ( cmd) => cmd. run ( SpinApp :: into_app ( ) ) . await ,
92
89
Self :: External ( cmd) => execute_external_subcommand ( cmd, SpinApp :: command ( ) ) . await ,
93
90
}
94
91
}
@@ -103,7 +100,3 @@ fn build_info() -> String {
103
100
env!( "VERGEN_GIT_COMMIT_DATE" )
104
101
)
105
102
}
106
-
107
- fn print_completions < G : clap_complete:: Generator > ( gen : G , cmd : & mut clap:: Command ) {
108
- clap_complete:: generate ( gen, cmd, cmd. get_name ( ) . to_string ( ) , & mut std:: io:: stdout ( ) )
109
- }
0 commit comments