@@ -45,16 +45,13 @@ func NewgenerateSottCmd() *cobra.Command {
4545 Technology: <tech>
4646 ` ),
4747 RunE : func (cmd * cobra.Command , args []string ) error {
48- if opts .FromDate == "" || opts .ToDate == "" || opts . Technology == "" {
48+ if opts .FromDate == "" || opts .ToDate == "" {
4949 if opts .FromDate == "" {
5050 fmt .Println ("FromDate (mm/dd/yyyy) is a required argument" )
5151 }
5252 if opts .ToDate == "" {
5353 fmt .Println ("ToDate (mm/dd/yyyy) is a required argument" )
5454 }
55- if opts .Technology == "" {
56- fmt .Println ("technology is a required argument" )
57- }
5855 return nil
5956 }
6057 return generate (opts )
@@ -67,15 +64,17 @@ func NewgenerateSottCmd() *cobra.Command {
6764
6865 fl .StringVarP (& opts .ToDate , "ToDate" , "t" , "" , "To Date" )
6966
70- fl .StringVarP (& opts .Technology , "technology" , "c" , "" , "technology" )
71-
7267 return cmd
7368}
7469
7570func generate (opts * sott ) error {
7671 conf := config .GetInstance ()
7772 opts .Comment = ""
7873 opts .Encoded = false
74+ opts .Technology = getTech ()
75+ if opts .Technology == "" {
76+ return nil
77+ }
7978 url = conf .AdminConsoleAPIDomain + "/deployment/sott?"
8079 body , _ := json .Marshal (opts )
8180 var resultResp Resp
@@ -94,3 +93,26 @@ func generate(opts *sott) error {
9493 fmt .Println ("Technology: " + resultResp .Technology )
9594 return nil
9695}
96+
97+ func getTech () string {
98+ var option string
99+ tech := map [string ]string {
100+ "1" : "android" ,
101+ "2" : "ios" ,
102+ }
103+ fmt .Println ("To select a Technology, choose a correponding number from the following options:" )
104+ fmt .Println ("1 - Android" )
105+ fmt .Println ("2 - iOS" )
106+ fmt .Printf ("Option: " )
107+ fmt .Scanf ("%s\n " , & option )
108+ if option == "" {
109+ fmt .Println ("Technology is a required argument" )
110+ return ""
111+ }
112+ Tech := tech [option ]
113+ if Tech == "" {
114+ fmt .Println ("Invalid Choice of Technology" )
115+ return ""
116+ }
117+ return Tech
118+ }
0 commit comments