sshkeeper/cmd
mirivlad cc83802244 fix: register the forward add local-port flag
`sshkeeper forward add` could never succeed. RunE read --local-port and init()
marked it required, but the flag was never registered on forwardAddCmd. Cobra
ignores MarkFlagRequired for an unknown flag, and GetInt returns 0 for one, so
every invocation failed validation with "invalid local port 0: must be
1-65535". There was no argument combination that worked.

Register the flag so both the read and the required annotation bind to a real
option. README and the guide already documented --local-port, so the intent was
there from the start; only the registration was missing.

The existing tests missed this because they build a throwaway cobra.Command,
register the flags on it themselves, and pass it to forwardAddCmd.RunE — the
real command's flag set was never exercised. Add a test that parses argv into
forwardAddCmd's own flags, plus one pinning the required annotation. Both fail
against the unfixed command with "unknown flag: --local-port".

Present since c2edaa4, so v0.2.0 and v0.3.0 both ship it broken.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 18:46:08 +08:00
..
add.go Add TUI tag and template management 2026-05-28 17:36:50 +08:00
add_test.go Add TUI tag and template management 2026-05-28 17:36:50 +08:00
config.go Initial commit: sshkeeper v0.1.0 2026-05-26 09:11:55 +08:00
connect.go sshkeeper: v0.2.0 — Phase 3: Port Forwarding Manager (DB, TUI screens, SSH args) 2026-06-03 10:15:55 +08:00
delete.go feat: improve tui and vault handling 2026-05-28 02:25:18 +08:00
edit.go Add TUI tag and template management 2026-05-28 17:36:50 +08:00
extra.go feat: replace tui action stubs 2026-06-06 03:26:17 +08:00
forward.go fix: register the forward add local-port flag 2026-08-18 18:46:08 +08:00
forward_test.go fix: register the forward add local-port flag 2026-08-18 18:46:08 +08:00
group.go Fix: test with password, group management, vault progress 2026-05-26 17:48:13 +08:00
init.go feat: add interactive server creation 2026-05-28 13:51:37 +08:00
list.go sshkeeper: v0.2.0 stabilization (route display, forward validation, tunnel UX, README) 2026-06-03 11:23:02 +08:00
root.go docs: clarify platform and repository status 2026-06-06 11:14:15 +08:00
root_test.go feat: add tunnel background cli management 2026-06-06 03:21:30 +08:00
route.go sshkeeper: v0.2.0 — Phase 4: CLI route/forward/tunnel commands 2026-06-03 10:32:18 +08:00
search.go sshkeeper: v0.2.0 — Phase 5: Search improvements (notes, tags, route, context) 2026-06-03 10:36:44 +08:00
secrets.go feat: improve tui and vault handling 2026-05-28 02:25:18 +08:00
secrets_test.go feat: improve tui and vault handling 2026-05-28 02:25:18 +08:00
show.go Add TUI tag and template management 2026-05-28 17:36:50 +08:00
ssh_config.go sshkeeper: v0.2.0 stabilization (route display, forward validation, tunnel UX, README) 2026-06-03 11:23:02 +08:00
template.go Add TUI tag and template management 2026-05-28 17:36:50 +08:00
tui.go fix: keep tui status and help context truthful 2026-08-14 03:20:42 +08:00
tunnel.go feat: add tunnel background cli management 2026-06-06 03:21:30 +08:00
tunnel_test.go feat: add tunnel background cli management 2026-06-06 03:21:30 +08:00
vault.go feat: replace tui action stubs 2026-06-06 03:26:17 +08:00
vault_test.go fix: improve vault and key passphrase flow 2026-05-28 13:38:53 +08:00