@@ -11,6 +11,7 @@ import (
1111
1212func (r * RootCmd )update ()* serpent.Command {
1313var (
14+ force bool
1415parameterFlags workspaceParameterFlags
1516bflags buildFlags
1617)
@@ -29,6 +30,19 @@ func (r *RootCmd) update() *serpent.Command {
2930if err != nil {
3031return err
3132}
33+
34+ // update command with --force flag is used as an alias for restart.
35+ // It can be used to update the workspace parameters for an already up-to-date workspace.
36+ if force {
37+ _ ,_ = fmt .Fprintf (inv .Stdout ,"Restarting %s to update the workspace parameters.\n " ,workspace .Name )
38+ return r .restart ().Handler (inv )
39+ }
40+
41+ if ! workspace .Outdated && len (parameterFlags .richParameters )!= 0 {
42+ _ ,_ = fmt .Fprintf (inv .Stdout ,"Workspace is up-to-date. Please add --force to update the workspace parameters.\n " )
43+ return nil
44+ }
45+
3246if ! workspace .Outdated && ! parameterFlags .promptRichParameters && ! parameterFlags .promptEphemeralParameters && len (parameterFlags .ephemeralParameters )== 0 {
3347_ ,_ = fmt .Fprintf (inv .Stdout ,"Workspace is up-to-date.\n " )
3448return nil
@@ -57,5 +71,11 @@ func (r *RootCmd) update() *serpent.Command {
5771
5872cmd .Options = append (cmd .Options ,parameterFlags .allOptions ()... )
5973cmd .Options = append (cmd .Options ,bflags .cliOptions ()... )
74+
75+ cmd .Options = append (cmd .Options , serpent.Option {
76+ Flag :"force" ,
77+ Description :"Force the update of the workspace even if it is up-to-date." ,
78+ Value :serpent .BoolOf (& force ),
79+ })
6080return cmd
6181}