@@ -32,10 +32,9 @@ import (
3232)
3333
3434var (
35- optControllerOutputPath string
36- cmdControllerPath string
37- pkgResourcePath string
38- latestAPIVersion string
35+ cmdControllerPath string
36+ pkgResourcePath string
37+ latestAPIVersion string
3938)
4039
4140var controllerCmd = & cobra.Command {
@@ -45,9 +44,6 @@ var controllerCmd = &cobra.Command{
4544}
4645
4746func init () {
48- controllerCmd .PersistentFlags ().StringVarP (
49- & optControllerOutputPath , "output" , "o" , "" , "path to root directory to create generated files. Defaults to " + optServicesDir + "/$service" ,
50- )
5147 rootCmd .AddCommand (controllerCmd )
5248}
5349
@@ -57,8 +53,8 @@ func generateController(cmd *cobra.Command, args []string) error {
5753 return fmt .Errorf ("please specify the service alias for the AWS service API to generate" )
5854 }
5955 svcAlias := strings .ToLower (args [0 ])
60- if optControllerOutputPath == "" {
61- optControllerOutputPath = filepath .Join (optServicesDir , svcAlias )
56+ if optOutputPath == "" {
57+ optOutputPath = filepath .Join (optServicesDir , svcAlias )
6258 }
6359
6460 if err := ensureSDKRepo (optCacheDir ); err != nil {
@@ -101,7 +97,7 @@ func generateController(cmd *cobra.Command, args []string) error {
10197 fmt .Println (strings .TrimSpace (contents .String ()))
10298 continue
10399 }
104- outPath := filepath .Join (optControllerOutputPath , path )
100+ outPath := filepath .Join (optOutputPath , path )
105101 outDir := filepath .Dir (outPath )
106102 if _ , err := ensureDir (outDir ); err != nil {
107103 return err
@@ -117,7 +113,7 @@ func generateController(cmd *cobra.Command, args []string) error {
117113// latest Kubernetes API version for CRDs exposed by the generated service
118114// controller.
119115func getLatestAPIVersion () (string , error ) {
120- apisPath := filepath .Join (optControllerOutputPath , "apis" )
116+ apisPath := filepath .Join (optOutputPath , "apis" )
121117 versions := []string {}
122118 subdirs , err := ioutil .ReadDir (apisPath )
123119 if err != nil {
0 commit comments