Documentation
¶
Overview ¶
Package cli defines the sshush command-line interface using Cobra. Commands include start, stop, list, add, remove, reload, create, edit, export, find, tui, completion, and version. Config is loaded in root PersistentPreRunE.
Index ¶
- Variables
- func AppendKeysTo(keyring sshagent.Agent, out *style.Output, socketPath, vaultPath string) error
- func ClearBytes(b []byte)
- func CopyToClipboard(text string) error
- func Execute() error
- func ListKeys(keyring sshagent.Agent) error
- func ListKeysSnapshotTo(keys []*sshagent.Key, w io.Writer) error
- func ListKeysTo(keyring sshagent.Agent, w io.Writer) error
- func LoadMergedConfig(configPath string, overrides LoadOverrides) (config.Config, error)
- func NewRootCommand() *cobra.Command
- func ReadPassphraseWithConfirm(firstPrompt, confirmPrompt string) ([]byte, error)
- type LoadOverrides
Constants ¶
This section is empty.
Variables ¶
var ErrPassphrasesDoNotMatch = errors.New("passphrases do not match")
ErrPassphrasesDoNotMatch is returned when confirmation does not match the first entry.
Functions ¶
func AppendKeysTo ¶
AppendKeysTo appends the keyring's key lines to an existing Output builder. When socketPath and vaultPath are set and the agent reports the vault locked via the vault-locked extension, shows a vault-specific message instead of the generic empty key list.
func ClearBytes ¶ added in v0.0.7
func ClearBytes(b []byte)
ClearBytes overwrites b with zeros. Use after handling sensitive passphrase material.
func CopyToClipboard ¶ added in v0.0.7
CopyToClipboard writes text to the system clipboard. Uses wl-copy (Wayland), xclip (X11), or pbcopy (macOS). Returns an error if the platform is unsupported or the command fails.
func Execute ¶
func Execute() error
Execute runs the root command and handles error display; StyledError is printed via PrintErr.
func ListKeysSnapshotTo ¶
ListKeysSnapshotTo writes a pre-fetched key list to w.
func ListKeysTo ¶
ListKeysTo writes the keyring's keys to w. Used for tests.
func LoadMergedConfig ¶
func LoadMergedConfig(configPath string, overrides LoadOverrides) (config.Config, error)
LoadMergedConfig loads config from path and applies overrides. If the config file is missing but the user supplied socket or key overrides, an empty config is used so the command can still run (e.g. using SSH_AUTH_SOCK for socket).
func NewRootCommand ¶
NewRootCommand returns the root cobra command for sshush with flags and PersistentPreRunE wired.
func ReadPassphraseWithConfirm ¶ added in v0.0.7
ReadPassphraseWithConfirm prompts twice (with two blank lines between, matching vault init UX) and returns the passphrase if both entries match. The confirmation buffer is cleared before return. On mismatch, both buffers are cleared. Caller should ClearBytes the returned slice when done.