detached 4005e23

fix: use cmd writer in bootstrap, conditional secret check

Bootstrap hint now writes to cmd.OutOrStdout() instead of os.Stdout.
Secret service nil check is now conditional on env/attachment_env presence.

Part of #98.
commit
4005e23d998352d2181b515e6d5f3da88176ca6a
author
brice · · 2026-03-13 21:17 UTC
parent
3cbff78
signature
unsigned
2 files · +5 -4
M internal/adapters/in/cli/bootstrap.go +3 -3
@@ -2,7 +2,6 @@ package cli
22
33 import (
44 "fmt"
5- "os"
65 "sort"
76 "strings"
87
@@ -77,10 +76,11 @@ func newBootstrapCmd() *cobra.Command {
7776 if err != nil {
7877 return fmt.Errorf("failed to bootstrap: %w", err)
7978 }
80- if err := cliWriteLine(os.Stdout, cliRenderSuccess("Bootstrap complete")); err != nil {
79+ out := cmd.OutOrStdout()
80+ if err := cliWriteLine(out, cliRenderSuccess("Bootstrap complete")); err != nil {
8181 return err
8282 }
83- return cliWriteLine(os.Stdout, fmt.Sprintf("Next: gordon push %s --build", req.Image))
83+ return cliWriteLine(out, fmt.Sprintf("Next: gordon push %s --build", req.Image))
8484 },
8585 }
8686
@@ -2,7 +2,6 @@ package cli
2 2
3 import (3 import (
4 "fmt"4 "fmt"
5- "os"
6 "sort"5 "sort"
7 "strings"6 "strings"
8 7
@@ -77,10 +76,11 @@ func newBootstrapCmd() *cobra.Command {
77 if err != nil {76 if err != nil {
78 return fmt.Errorf("failed to bootstrap: %w", err)77 return fmt.Errorf("failed to bootstrap: %w", err)
79 }78 }
80- if err := cliWriteLine(os.Stdout, cliRenderSuccess("Bootstrap complete")); err != nil {79+ out := cmd.OutOrStdout()
80+ if err := cliWriteLine(out, cliRenderSuccess("Bootstrap complete")); err != nil {
81 return err81 return err
82 }82 }
83- return cliWriteLine(os.Stdout, fmt.Sprintf("Next: gordon push %s --build", req.Image))83+ return cliWriteLine(out, fmt.Sprintf("Next: gordon push %s --build", req.Image))
84 },84 },
85 }85 }
86 86
M internal/adapters/in/cli/controlplane_local.go +2 -1
@@ -133,7 +133,8 @@ func (l *localControlPlane) Bootstrap(ctx context.Context, req dto.BootstrapRequ
133133 if l.configSvc == nil {
134134 return resp, fmt.Errorf("local config service unavailable")
135135 }
136- if l.secretSvc == nil {
136+ needsSecrets := len(req.Env) > 0 || len(req.AttachmentEnv) > 0
137+ if needsSecrets && l.secretSvc == nil {
137138 return resp, fmt.Errorf("local secret service unavailable")
138139 }
139140
@@ -133,7 +133,8 @@ func (l *localControlPlane) Bootstrap(ctx context.Context, req dto.BootstrapRequ
133 if l.configSvc == nil {133 if l.configSvc == nil {
134 return resp, fmt.Errorf("local config service unavailable")134 return resp, fmt.Errorf("local config service unavailable")
135 }135 }
136- if l.secretSvc == nil {136+ needsSecrets := len(req.Env) > 0 || len(req.AttachmentEnv) > 0
137+ if needsSecrets && l.secretSvc == nil {
137 return resp, fmt.Errorf("local secret service unavailable")138 return resp, fmt.Errorf("local secret service unavailable")
138 }139 }
139 140

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close