[object Object]

← back to Cli Printing Press

fix(cli): always emit usageErr helper (#162)

4d3c31f87eb3306bdcae307a3a6c35c04b3fd028 · 2026-04-11 00:07:05 -0400 · Matt Van Horn

The HasMultiPositional gate was misaligned with actual template usage:
command_promoted.go.tmpl calls usageErr unconditionally on single-positional
promoted commands, causing 'undefined: usageErr' build failures when the
spec has no multi-positional endpoints. Dropping the gate fixes it without
cost (Go permits unused package-level functions). Caught while generating
archive-is-pp-cli, which has only single-positional promoted commands.

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>

Files touched

Diff

commit 4d3c31f87eb3306bdcae307a3a6c35c04b3fd028
Author: Matt Van Horn <mvanhorn@users.noreply.github.com>
Date:   Sat Apr 11 00:07:05 2026 -0400

    fix(cli): always emit usageErr helper (#162)
    
    The HasMultiPositional gate was misaligned with actual template usage:
    command_promoted.go.tmpl calls usageErr unconditionally on single-positional
    promoted commands, causing 'undefined: usageErr' build failures when the
    spec has no multi-positional endpoints. Dropping the gate fixes it without
    cost (Go permits unused package-level functions). Caught while generating
    archive-is-pp-cli, which has only single-positional promoted commands.
    
    Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
---
 internal/generator/templates/helpers.go.tmpl | 2 --
 1 file changed, 2 deletions(-)

diff --git a/internal/generator/templates/helpers.go.tmpl b/internal/generator/templates/helpers.go.tmpl
index 51c27f29..2bdf502a 100644
--- a/internal/generator/templates/helpers.go.tmpl
+++ b/internal/generator/templates/helpers.go.tmpl
@@ -94,9 +94,7 @@ type cliError struct {
 func (e *cliError) Error() string { return e.err.Error() }
 func (e *cliError) Unwrap() error { return e.err }
 
-{{- if .HasMultiPositional}}
 func usageErr(err error) error    { return &cliError{code: 2, err: err} }
-{{- end}}
 func notFoundErr(err error) error { return &cliError{code: 3, err: err} }
 func authErr(err error) error     { return &cliError{code: 4, err: err} }
 func apiErr(err error) error      { return &cliError{code: 5, err: err} }

← cbcd67db feat(cli): add printing-press-library plugin to marketplace  ·  back to Cli Printing Press  ·  fix(cli): retro fixes from trigger-dev generation (#159) f9e6c108 →