Documentation
¶
Index ¶
- func RenderRules(c *Config) string
- type AddOptions
- type Config
- type ConfigManager
- type Executer
- func (e *Executer) Add(args []string, opts AddOptions, w io.Writer, in io.Reader, interactive bool) error
- func (e *Executer) Delete(name string, w io.Writer) error
- func (e *Executer) Edit() error
- func (e *Executer) Exec(args []string, stderr io.Writer) (int, error)
- func (e *Executer) Install() error
- func (e *Executer) List(w io.Writer) error
- func (e *Executer) Show(name string, w io.Writer) error
- func (e *Executer) Uninstall(purge bool) error
- type HeaderSource
- type Output
- type ParsedSource
- type Profile
- type Prompter
- func (p *Prompter) ConfirmHostConflict(newName, existingName, host string) (bool, error)
- func (p *Prompter) ConfirmUpdate(profileName string) (bool, error)
- func (p *Prompter) CookieStorage() (StorageChoice, error)
- func (p *Prompter) PickCookies(cookies []curlparse.Cookie) error
- func (p *Prompter) PickHeaders(headers []curlparse.Header) error
- func (p *Prompter) Storage(headerName, maskedValue string) (StorageChoice, error)
- type ResolvedHeader
- type RulesTarget
- type StorageChoice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderRules ¶
RenderRules returns the markdown rules text including the profile list.
Types ¶
type AddOptions ¶
AddOptions controls pcurl add behavior.
type Config ¶
Config represents the top-level profiles.toml structure.
func (*Config) FindProfile ¶
func (*Config) FindProfileByHost ¶
FindProfileByHost returns the profile name whose MatchHosts contains host.
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager owns config file path and load/save operations.
func NewConfigManager ¶
func NewConfigManager() *ConfigManager
func NewConfigManagerWithDir ¶
func NewConfigManagerWithDir(dir string) *ConfigManager
NewConfigManagerWithDir creates a ConfigManager with a custom directory (for tests).
func (*ConfigManager) Dir ¶
func (cm *ConfigManager) Dir() string
func (*ConfigManager) EnsureDir ¶
func (cm *ConfigManager) EnsureDir() error
EnsureDir creates the config directory with 0700 permissions.
func (*ConfigManager) Load ¶
func (cm *ConfigManager) Load() (*Config, error)
Load reads and parses profiles.toml. Returns empty config if file does not exist.
func (*ConfigManager) Path ¶
func (cm *ConfigManager) Path() string
func (*ConfigManager) Save ¶
func (cm *ConfigManager) Save(c *Config) error
Save writes config to profiles.toml with 0600 permissions.
type Executer ¶
type Executer struct {
CM *ConfigManager
Keyring keyring.Keyring
}
Executer holds shared dependencies and provides all pcurl commands.
func (*Executer) Add ¶
func (e *Executer) Add(args []string, opts AddOptions, w io.Writer, in io.Reader, interactive bool) error
Add parses a curl command, classifies headers, prompts for storage, saves secrets, writes profile, and updates agent rules.
func (*Executer) Exec ¶
Exec resolves a profile's headers, then executes curl. Looks for @profile in args. If not found, checks MatchHosts and warns.
type HeaderSource ¶
type HeaderSource int
HeaderSource describes where a header value comes from.
const ( SourcePlaintext HeaderSource = iota SourceKeychain SourceEnv )
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output collects lines and prints them all at once.
type ParsedSource ¶
type ParsedSource struct {
Name string
Source HeaderSource
Ref string
}
ParsedSource is the result of parsing a single header line from TOML.
func ParseHeaderSource ¶
func ParseHeaderSource(raw string) ParsedSource
ParseHeaderSource splits "Authorization: keychain:gh/auth" into components.
type Profile ¶
type Profile struct {
Description string `toml:"Description,omitempty"`
MatchHosts []string `toml:"MatchHosts"`
Headers []string `toml:"Headers"`
}
Profile represents a single named credential profile.
type Prompter ¶
Prompter handles all interactive prompts. When Interactive is true, uses huh TUI (arrow keys, space to toggle). Otherwise falls back to plain text input (for tests, pipes, non-TTY).
func NewPrompter ¶
NewPrompter creates a Prompter with shared scanner.
func (*Prompter) ConfirmHostConflict ¶ added in v0.0.3
ConfirmHostConflict asks whether to create a new profile when the host is already covered by a differently-named profile.
func (*Prompter) ConfirmUpdate ¶
ConfirmUpdate asks "Profile X already exists. Update? Y/n".
func (*Prompter) CookieStorage ¶
func (p *Prompter) CookieStorage() (StorageChoice, error)
CookieStorage asks where to store selected cookies.
func (*Prompter) PickCookies ¶
PickCookies shows cookies and lets the user toggle selection.
func (*Prompter) PickHeaders ¶
PickHeaders shows non-secret headers and lets the user toggle selection.
type ResolvedHeader ¶
ResolvedHeader is a header ready to be passed to curl.
type RulesTarget ¶
RulesTarget describes a supported agent rules file location.
func DetectTargets ¶
func DetectTargets() []RulesTarget
DetectTargets returns all agent rule targets found on the system.
type StorageChoice ¶
type StorageChoice int
StorageChoice is where to store a secret value.
const ( StoreKeychain StorageChoice = iota StoreConfig StoreSkip )