@@ -142,17 +142,24 @@ type cliSpec struct {
142142 List struct {
143143 Why bool `help:"Shows the reason why the stack has changed."`
144144 ExperimentalStatus string `hidden:"" help:"Filter by status (Deprecated)"`
145- CloudStatus string `help:"Filter by Terramate Cloud status of the stack."`
145+ CloudStatus string `hidden:""`
146+ Status string `help:"Filter by Terramate Cloud status of the stack."`
146147 RunOrder bool `default:"false" help:"Sort listed stacks by order of execution"`
147148 } `cmd:"" help:"List stacks."`
148149
149150 Run struct {
150- CloudStatus string `help:"Filter by Terramate Cloud status of the stack."`
151- CloudSyncDeployment bool `default:"false" help:"Synchronize the command as a new deployment to Terramate Cloud."`
152- CloudSyncDriftStatus bool `default:"false" help:"Synchronize the command as a new drift run to Terramate Cloud."`
153- CloudSyncPreview bool `default:"false" help:"Synchronize the command as a new preview to Terramate Cloud."`
154- CloudSyncLayer preview.Layer `default:"" help:"Set a customer layer for synchronizing a preview to Terramate Cloud."`
155- CloudSyncTerraformPlanFile string `default:"" help:"Add details of the Terraform Plan file to the synchronization to Terramate Cloud."`
151+ CloudStatus string `hidden:""`
152+ Status string `help:"Filter by Terramate Cloud status of the stack."`
153+ CloudSyncDeployment bool `hidden:""`
154+ SyncDeployment bool `default:"false" help:"Synchronize the command as a new deployment to Terramate Cloud."`
155+ CloudSyncDriftStatus bool `hidden:""`
156+ SyncDriftStatus bool `default:"false" help:"Synchronize the command as a new drift run to Terramate Cloud."`
157+ CloudSyncPreview bool `hidden:""`
158+ SyncPreview bool `default:"false" help:"Synchronize the command as a new preview to Terramate Cloud."`
159+ CloudSyncLayer preview.Layer `hidden:""`
160+ Layer preview.Layer `default:"" help:"Set a customer layer for synchronizing a preview to Terramate Cloud."`
161+ CloudSyncTerraformPlanFile string `hidden:""`
162+ TerraformPlanFile string `default:"" help:"Add details of the Terraform Plan file to the synchronization to Terramate Cloud."`
156163 DebugPreviewURL string `hidden:"true" default:"" help:"Create a debug preview URL to Terramate Cloud details."`
157164 ContinueOnError bool `default:"false" help:"Do not stop execution when an error occurs."`
158165 NoRecursive bool `default:"false" help:"Do not recurse into nested child stacks."`
@@ -182,7 +189,8 @@ type cliSpec struct {
182189 Cmds []string `arg:"" optional:"true" passthrough:"" help:"Script to show info for."`
183190 } `cmd:"" help:"Show detailed information about a script"`
184191 Run struct {
185- CloudStatus string `help:"Filter by Terramate Cloud status of the stack."`
192+ CloudStatus string `hidden:""`
193+ Status string `help:"Filter by Terramate Cloud status of the stack."`
186194 NoRecursive bool `default:"false" help:"Do not recurse into nested child stacks."`
187195 ContinueOnError bool `default:"false" help:"Continue executing next stacks when a command returns an error."`
188196 DryRun bool `default:"false" help:"Plan the execution but do not execute it."`
@@ -227,7 +235,8 @@ type cliSpec struct {
227235 Stack string `arg:"" optional:"true" name:"stack" predictor:"file" help:"The stacks path."`
228236 Reason string `default:"" name:"reason" help:"Set a reason for triggering the stack."`
229237 ExperimentalStatus string `hidden:"" help:"Filter by Terramate Cloud status of the stack. (deprecated)"`
230- CloudStatus string `help:"Filter by Terramate Cloud status of the stack."`
238+ CloudStatus string `hidden:""`
239+ Status string `help:"Filter by Terramate Cloud status of the stack."`
231240 } `cmd:"" help:"Mark a stack as changed so it will be triggered in Change Detection."`
232241
233242 RunGraph struct {
@@ -425,6 +434,8 @@ func newCLI(version string, args []string, stdin io.Reader, stdout, stderr io.Wr
425434 fatal ("failed to load cli configuration file" , err )
426435 }
427436
437+ migrateFlagAliases (& parsedArgs )
438+
428439 // cmdline flags override configuration file.
429440
430441 if parsedArgs .DisableCheckpoint {
@@ -877,11 +888,44 @@ func hasVendorDirConfig(cfg hcl.Config) bool {
877888 return cfg .Vendor != nil && cfg .Vendor .Dir != ""
878889}
879890
891+ func migrateFlagAliases (parsedArgs * cliSpec ) {
892+ // list
893+ migrateStringFlag (& parsedArgs .List .Status , parsedArgs .List .CloudStatus )
894+
895+ // run
896+ migrateStringFlag (& parsedArgs .Run .Status , parsedArgs .Run .CloudStatus )
897+ migrateBoolFlag (& parsedArgs .Run .SyncDeployment , parsedArgs .Run .CloudSyncDeployment )
898+ migrateBoolFlag (& parsedArgs .Run .SyncDriftStatus , parsedArgs .Run .CloudSyncDriftStatus )
899+ migrateBoolFlag (& parsedArgs .Run .SyncPreview , parsedArgs .Run .CloudSyncPreview )
900+ migrateStringFlag (& parsedArgs .Run .TerraformPlanFile , parsedArgs .Run .CloudSyncTerraformPlanFile )
901+ if parsedArgs .Run .CloudSyncLayer != "" && parsedArgs .Run .Layer == "" {
902+ parsedArgs .Run .Layer = parsedArgs .Run .CloudSyncLayer
903+ }
904+
905+ // script run
906+ migrateStringFlag (& parsedArgs .Script .Run .Status , parsedArgs .Script .Run .CloudStatus )
907+
908+ // experimental trigger
909+ migrateStringFlag (& parsedArgs .Experimental .Trigger .Status , parsedArgs .Experimental .Trigger .CloudStatus )
910+ }
911+
912+ func migrateStringFlag (flag * string , alias string ) {
913+ if alias != "" && * flag == "" {
914+ * flag = alias
915+ }
916+ }
917+
918+ func migrateBoolFlag (flag * bool , alias bool ) {
919+ if alias && ! * flag {
920+ * flag = alias
921+ }
922+ }
923+
880924func (c * cli ) triggerStackByFilter () {
881925 expStatus := c .parsedArgs .Experimental .Trigger .ExperimentalStatus
882- cloudStatus := c .parsedArgs .Experimental .Trigger .CloudStatus
926+ cloudStatus := c .parsedArgs .Experimental .Trigger .Status
883927 if expStatus != "" && cloudStatus != "" {
884- fatal ("--experimental-status and --cloud- status cannot be used together" , nil )
928+ fatal ("--experimental-status and --status cannot be used together" , nil )
885929 }
886930
887931 statusStr := expStatus
@@ -890,7 +934,7 @@ func (c *cli) triggerStackByFilter() {
890934 }
891935
892936 if statusStr == "" {
893- fatal ("trigger command expects either a stack path or the --cloud- status flag" , nil )
937+ fatal ("trigger command expects either a stack path or the --status flag" , nil )
894938 }
895939
896940 status := parseStatusFilter (statusStr )
@@ -1555,9 +1599,9 @@ func (c *cli) printStacks() {
15551599 }
15561600
15571601 expStatus := c .parsedArgs .List .ExperimentalStatus
1558- cloudStatus := c .parsedArgs .List .CloudStatus
1602+ cloudStatus := c .parsedArgs .List .Status
15591603 if expStatus != "" && cloudStatus != "" {
1560- fatal ("Invalid args" , errors .E ("--experimental-status and --cloud- status cannot be used together" ))
1604+ fatal ("Invalid args" , errors .E ("--experimental-status and --status cannot be used together" ))
15611605 }
15621606
15631607 statusStr := expStatus
0 commit comments