feat: add --clear and --replace flags to ps:scale

The `ps:scale` command merges the specified process types into the existing formation, so replacing an entire formation from the CLI required reading the current scale, diffing it, and issuing a second call to zero out each unlisted process type. The `--replace` flag treats the specified process types as the whole formation and sets the process count for every unspecified process type to zero, while the `--clear` flag resets the formation to the scale a newly created app has. The two flags cannot be combined, `--replace` requires at least one process type, and `--clear` accepts none. Process types cleared this way are now scaled down as part of the same command rather than being left running with a stale formation.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-09-02 14:55:16 -04:00
1 parent 63351209f8
commit db45f8608b
10 files changed
+391 -21

No files matched your search

+10 -1
View File
@@ -65,11 +65,20 @@ func main() {
case "scale":
args := flag.NewFlagSet("ps:scale", flag.ExitOnError)
skipDeploy := args.Bool("skip-deploy", false, "--skip-deploy: skip deploy of the app")
clearFormation := args.Bool("clear", false, "--clear: reset the formation to the default scale")
replace := args.Bool("replace", false, "--replace: replace the formation and scale unspecified process types to zero")
format := args.String("format", "stdout", "format: [ stdout | json ]")
args.Parse(os.Args[2:])
appName := args.Arg(0)
_, processTuples := common.ShiftString(args.Args())
err = ps.CommandScale(appName, *skipDeploy, *format, processTuples)
err = ps.CommandScale(ps.CommandScaleInput{
AppName: appName,
Clear: *clearFormation,
Format: *format,
ProcessTuples: processTuples,
Replace: *replace,
SkipDeploy: *skipDeploy,
})
case "set":
args := flag.NewFlagSet("ps:set", flag.ExitOnError)
global := args.Bool("global", false, "--global: set a global property")