@@ -12,24 +12,26 @@ import (
1212
1313func NewUpdateCommand () * cobra.Command {
1414 cmd := & cobra.Command {
15- Use : "update <service_uuid> <env_uuid> " ,
15+ Use : "update <service_uuid>" ,
1616 Short : "Update an environment variable" ,
17- Long : `Update an existing environment variable. First UUID is the service, second is the specific environment variable to update .` ,
18- Args : cli .ExactArgs (2 , "<uuid1> <uuid2 >" ),
17+ Long : `Update an existing environment variable. UUID is the service.` ,
18+ Args : cli .ExactArgs (1 , "<service_uuid >" ),
1919 RunE : func (cmd * cobra.Command , args []string ) error {
2020 ctx := cmd .Context ()
2121 serviceUUID := args [0 ]
22- envUUID := args [1 ]
2322
2423 client , err := cli .GetAPIClient (cmd )
2524 if err != nil {
2625 return fmt .Errorf ("failed to get API client: %w" , err )
2726 }
2827
29- req := & models.ServiceEnvironmentVariableUpdateRequest {
30- UUID : envUUID ,
28+ // Check minimum version requirement
29+ if err := cli .CheckMinimumVersion (ctx , client , "4.0.0-beta.469" ); err != nil {
30+ return err
3131 }
3232
33+ req := & models.ServiceEnvironmentVariableUpdateRequest {}
34+
3335 // Only set fields that were provided
3436 if cmd .Flags ().Changed ("key" ) {
3537 key , _ := cmd .Flags ().GetString ("key" )
@@ -56,9 +58,11 @@ func NewUpdateCommand() *cobra.Command {
5658 req .IsRuntime = & isRuntime
5759 }
5860
59- // Check if at least one field is being updated
60- if req .Key == nil && req .Value == nil && req .IsBuildTime == nil && req .IsLiteral == nil && req .IsMultiline == nil && req .IsRuntime == nil {
61- return fmt .Errorf ("at least one field must be provided to update (--key, --value, --build-time, --is-literal, --is-multiline, or --runtime)" )
61+ if req .Key == nil {
62+ return fmt .Errorf ("--key is required" )
63+ }
64+ if req .Value == nil {
65+ return fmt .Errorf ("--value is required" )
6266 }
6367
6468 serviceSvc := service .NewService (client )
0 commit comments