File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -106,10 +106,22 @@ func main() {
106106 }
107107}
108108
109- const SCW_INIT_COMMAND = "scw config destroy && scw init secret-key=%s access-key=%s organization-id=%s send-telemetry=false install-autocomplete=true"
109+ const SCW_DESTROY_COMMAND = "scw config destroy"
110+ const SCW_INIT_COMMAND = "scw init secret-key=%s access-key=%s organization-id=%s send-telemetry=false install-autocomplete=true"
110111
111112func scalewayInit (apiKey * ApiKey , organizationId string ) {
112113 command := fmt .Sprintf (SCW_INIT_COMMAND , apiKey .SecretKey , apiKey .AccessKey , organizationId )
114+
115+ executeCmd (SCW_DESTROY_COMMAND )
116+ err := executeCmd (command )
117+ if err != nil {
118+ fmt .Println ("Command execution failed" , err )
119+ } else {
120+ fmt .Println ("Command executed successfully" )
121+ }
122+ }
123+
124+ func executeCmd (command string ) error {
113125 var cmd * exec.Cmd
114126 if runtime .GOOS == "windows" {
115127 cmd = exec .Command ("cmd.exe" , "/c" , command )
@@ -120,9 +132,5 @@ func scalewayInit(apiKey *ApiKey, organizationId string) {
120132 cmd .Stdout = os .Stdout
121133 cmd .Stderr = os .Stderr
122134
123- if err := cmd .Run (); err != nil {
124- fmt .Println ("Command execution failed" , err )
125- } else {
126- fmt .Println ("Command executed successfully" )
127- }
135+ return cmd .Run ()
128136}
You can’t perform that action at this time.
0 commit comments