Summary
urlbox projects defaults show <project> prints zero bytes in text mode when the project has no default options. The JSON envelope carries a perfectly good summary; text mode drops it.
Reproduce
-
Pick any project with no defaultOptions set.
-
Run it in text mode:
urlbox projects defaults show <project> --output-format text
Expected
A line saying there are no defaults — the summary the envelope already contains.
Actual
Nothing. Exit code 0, empty stdout:
$ urlbox projects defaults show <project> --output-format text | wc -c
0
JSON mode has the message all along:
{
"ok": true,
"command": "projects defaults show",
"data": {"defaults": {}, "project": "proj_xxx"},
"summary": "0 default options on proj_xxx"
}
A command that prints nothing and exits 0 is indistinguishable from a hang or a silently broken subcommand.
Cause
Two behaviours combine:
runProjectsDefaultsShow called env.SetKV(...) unconditionally, so with zero defaults the view was non-nil (suppressing the summary) but rendered nothing. Net result: no output at all.
Fix
Attach the view only when there is something in it, so the existing summary survives — internal/cmd/projects.go:
// A viewless envelope keeps its summary in text mode; an empty KV view
// renders nothing at all, so a project with no defaults would print
// zero bytes. Only attach the view when there is something to show.
if pairs := optionsKVPairs(defaults); len(pairs) > 0 {
env.SetKV(pairs)
}
Text mode then prints 0 default options on proj_xxx. JSON output is unchanged.
Worth checking whether any other command calls SetKV/SetTable with a possibly-empty collection — the same silent-empty-output pattern would apply.
Environment
urlbox 1.2.0 (commit 5530665), Linux.
Summary
urlbox projects defaults show <project>prints zero bytes in text mode when the project has no default options. The JSON envelope carries a perfectly good summary; text mode drops it.Reproduce
Pick any project with no
defaultOptionsset.Run it in text mode:
Expected
A line saying there are no defaults — the summary the envelope already contains.
Actual
Nothing. Exit code 0, empty stdout:
JSON mode has the message all along:
{ "ok": true, "command": "projects defaults show", "data": {"defaults": {}, "project": "proj_xxx"}, "summary": "0 default options on proj_xxx" }A command that prints nothing and exits 0 is indistinguishable from a hang or a silently broken subcommand.
Cause
Two behaviours combine:
internal/output/format.go:60prints the summary only when there is no view:internal/output/render.go:74—RenderKVreturns early on an empty slice ("An empty pairs writes nothing").runProjectsDefaultsShowcalledenv.SetKV(...)unconditionally, so with zero defaults the view was non-nil (suppressing the summary) but rendered nothing. Net result: no output at all.Fix
Attach the view only when there is something in it, so the existing summary survives —
internal/cmd/projects.go:Text mode then prints
0 default options on proj_xxx. JSON output is unchanged.Worth checking whether any other command calls
SetKV/SetTablewith a possibly-empty collection — the same silent-empty-output pattern would apply.Environment
urlbox 1.2.0(commit 5530665), Linux.