You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve usability of CLI, particularly create command (#20)
Updates to improve usability of the CLI:
* Refactoring and adding tests along with CI
* `create` without an ID (relies on API change shipping first)
* Support `--visibility` and `--name` to set those properties on
`create` command.
* `--init` option on `create` command to do both at once
* Fix for spurious Go marshaling error printed by `create` command
fmt.Printf("Error: Invalid environment variable format (%s). Must be in the form 'key=value'\n", pair)
61
-
return
62
-
}
63
+
fmt.Printf("App created: %s\n", resp.AppUrl)
64
+
ifresp.ID!="" {
65
+
fmt.Printf("ID: %s\n", resp.ID)
63
66
}
67
+
returnnil
68
+
},
69
+
}
64
70
65
-
for_, pair:=rangecreateCmdFlags.Secrets {
66
-
parts:=strings.SplitN(pair, "=", 2)
67
-
iflen(parts) ==2 {
68
-
key:=parts[0]
69
-
value:=parts[1]
70
-
requestBody.Secrets[key] =value
71
-
} else {
72
-
fmt.Printf("Error: Invalid secret format (%s). Must be in the form 'key=value'\n", pair)
73
-
return
74
-
}
75
-
}
71
+
createCmd.Flags().StringVarP(&createCmdFlags.app, "app", "a", "", "The app ID to create")
72
+
createCmd.Flags().StringVarP(&createCmdFlags.name, "name", "n", "", "The name for the app")
73
+
createCmd.Flags().StringVarP(&createCmdFlags.visibility, "visibility", "v", "", "The visibility of the app (e.g. 'only_owner' or 'github')")
74
+
createCmd.Flags().StringSliceVarP(&createCmdFlags.environmentVariables, "env", "e", []string{}, "Environment variables to set on the app in the form 'key=value'")
75
+
createCmd.Flags().StringSliceVarP(&createCmdFlags.secrets, "secret", "s", []string{}, "Secrets to set on the app in the form 'key=value'")
76
+
createCmd.Flags().StringVarP(&createCmdFlags.revisionName, "revision-name", "r", "", "The revision name to use for the app")
77
+
createCmd.Flags().BoolVar(&createCmdFlags.init, "init", false, "Initialize a runtime.config.json file in the current directory after creating the app")
returncreateResp{}, fmt.Errorf("invalid environment variable format (%s). Must be in the form 'key=value'", pair)
99
+
}
106
100
}
107
101
108
-
createCmd.Flags().StringVarP(&createCmdFlags.app, "app", "a", "", "The app to create")
109
-
createCmd.Flags().StringSliceVarP(&createCmdFlags.EnvironmentVariables, "env", "e", []string{}, "Environment variables to set on the app in the form 'key=value'")
110
-
createCmd.Flags().StringSliceVarP(&createCmdFlags.Secrets, "secret", "s", []string{}, "Secrets to set on the app in the form 'key=value'")
111
-
createCmd.Flags().StringVarP(&createCmdFlags.RevisionName, "revision-name", "r", "", "The revision name to use for the app")
112
-
rootCmd.AddCommand(createCmd)
102
+
for_, pair:=rangeflags.secrets {
103
+
parts:=strings.SplitN(pair, "=", 2)
104
+
iflen(parts) ==2 {
105
+
requestBody.Secrets[parts[0]] =parts[1]
106
+
} else {
107
+
returncreateResp{}, fmt.Errorf("invalid secret format (%s). Must be in the form 'key=value'", pair)
0 commit comments