MCPcopy Index your code
hub / github.com/codehamr/codehamr / cmdHamrpass

Method cmdHamrpass

internal/tui/slash.go:282–297  ·  view source on GitHub ↗

cmdHamrpass: `/hamrpass` shows status + how-to, `/hamrpass ` validates, saves the key on the managed hamrpass profile, switches active, and pings the backend. Validation lives in hamrpassValidate so the popover hint and the inline error stay in lockstep.

(args []string)

Source from the content-addressed store, hash-verified

280// cmdHamrpass: `/hamrpass` shows status + how-to, `/hamrpass <key>` validates,
281// saves the key on the managed hamrpass profile, switches active, and pings the
282// backend. Validation lives in hamrpassValidate so the popover hint and the
283// inline error stay in lockstep.
284func (m Model) cmdHamrpass(args []string) (tea.Model, tea.Cmd) {
285 if len(args) == 0 {
286 m.printHamrpassStatus()
287 return m, nil
288 }
289 if len(args) > 1 {
290 m.appendLine(styleError.Render("⚠ hamrpass keys cannot contain spaces"))
291 return m, nil
292 }
293 key, hint, ok := hamrpassValidate(args[0])
294 if !ok {
295 m.appendLine(styleError.Render("⚠ " + hint))
296 return m, nil
297 }
298 return m, m.activateHamrpass(key)
299}
300

Callers

nothing calls this directly

Calls 4

printHamrpassStatusMethod · 0.95
appendLineMethod · 0.95
activateHamrpassMethod · 0.95
hamrpassValidateFunction · 0.85

Tested by

no test coverage detected