Description
defang cd refresh succeeds (exit 0) and does nothing when it is called without a PROJECT/STACK argument.
cdCommand (src/cmd/cli/command/cd.go) loops over args. With zero args, the loop body never runs and errors.Join() of an empty slice returns nil. The command prints nothing and exits 0, so the caller believes a refresh happened.
Every other PROJECT/STACK subcommand under cd declares Args: cobra.MinimumNArgs(1):
cd destroy — has it
cd down — has it
cd cancel — has it
cd outputs — has it
cd refresh — missing
The fix is one line: add Args: cobra.MinimumNArgs(1) to cdRefreshCmd. Alternatively, make the no-arg form load the project name from the local compose file and refresh the current stack, which matches what users probably expect. Either behavior is better than a silent success.
Steps to reproduce
defang cd refresh # in any directory, with any provider configured
echo $? # 0, nothing happened
Found while adding a manual-refresh workflow for s.defang.io (DefangLabs/s.defang.io PR 23, review comment r3771401029).
Description
defang cd refreshsucceeds (exit 0) and does nothing when it is called without aPROJECT/STACKargument.cdCommand(src/cmd/cli/command/cd.go) loops overargs. With zero args, the loop body never runs anderrors.Join()of an empty slice returns nil. The command prints nothing and exits 0, so the caller believes a refresh happened.Every other PROJECT/STACK subcommand under
cddeclaresArgs: cobra.MinimumNArgs(1):cd destroy— has itcd down— has itcd cancel— has itcd outputs— has itcd refresh— missingThe fix is one line: add
Args: cobra.MinimumNArgs(1)tocdRefreshCmd. Alternatively, make the no-arg form load the project name from the local compose file and refresh the current stack, which matches what users probably expect. Either behavior is better than a silent success.Steps to reproduce
Found while adding a manual-refresh workflow for s.defang.io (DefangLabs/s.defang.io PR 23, review comment r3771401029).