cli

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: Unlicense Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUpdateArgs    = errors.New("no update arguments provided; specify at least one of --set-name, --add-label, or --remove-label")
	ErrNoSecretUpdated = errors.New("no secret was updated")
)
View Source
var ErrNoSecretInserted = errors.New("no secret was inserted")
View Source
var Version = "0.0.0"

Functions

func NewCmdConfig

func NewCmdConfig(defaults *DefaultVltOptions) *cobra.Command

NewCmdConfig creates the cobra config command tree.

func NewCmdCreate

func NewCmdCreate(defaults *DefaultVltOptions) *cobra.Command

NewCmdCreate creates the create cobra command.

func NewCmdExport

func NewCmdExport(defaults *DefaultVltOptions) *cobra.Command

NewCmdExport creates the export cobra command.

func NewCmdFind

func NewCmdFind(defaults *DefaultVltOptions) *cobra.Command

NewCmdFind creates the find cobra command.

func NewCmdGenerate

func NewCmdGenerate(defaults *DefaultVltOptions) *cobra.Command

NewCmdGenerate creates the Generate cobra command.

func NewCmdImport

func NewCmdImport(defaults *DefaultVltOptions) *cobra.Command

NewCmdImport creates the import cobra command.

func NewCmdLogin

func NewCmdLogin(defaults *DefaultVltOptions) *cobra.Command

NewCmdLogin creates the login cobra command.

func NewCmdLogout

func NewCmdLogout(defaults *DefaultVltOptions) *cobra.Command

NewCmdLogout creates the logout cobra command.

func NewCmdRemove

func NewCmdRemove(defaults *DefaultVltOptions) *cobra.Command

NewCmdRemove creates the remove cobra command.

func NewCmdRotate

func NewCmdRotate(defaults *DefaultVltOptions) *cobra.Command

NewCmdRotate creates the create cobra command.

func NewCmdSave

func NewCmdSave(defaults *DefaultVltOptions) *cobra.Command

NewCmdSave creates the save cobra command.

func NewCmdShow

func NewCmdShow(defaults *DefaultVltOptions) *cobra.Command

NewCmdShow creates the Show cobra command.

func NewCmdUpdate

func NewCmdUpdate(defaults *DefaultVltOptions) *cobra.Command

NewCmdUpdate creates the update cobra command.

func NewCmdUpdateSecretValue

func NewCmdUpdateSecretValue(defaults *DefaultVltOptions) *cobra.Command

NewCmdUpdateSecretValue creates the cobra command.

func NewCmdVacuum

func NewCmdVacuum(defaults *DefaultVltOptions) *cobra.Command

NewCmdVacuum creates the vacuum cobra command.

func NewDefaultVltCommand

func NewDefaultVltCommand(iostreams *genericclioptions.IOStreams, args []string) *cobra.Command

NewDefaultVltCommand creates the `vlt` command with its sub-commands.

Types

type ClipboardConfig

type ClipboardConfig struct {
	CopyCmd  []string `` /* 146-byte string literal not displayed */
	PasteCmd []string `` /* 149-byte string literal not displayed */
}

ClipboardConfig defines commands for clipboard ops.

type ConfigError

type ConfigError struct {
	Opt string
	Err error
}

func (*ConfigError) Error

func (e *ConfigError) Error() string

func (*ConfigError) Unwrap

func (e *ConfigError) Unwrap() error

type ConfigOptions

type ConfigOptions struct {
	*genericclioptions.StdioOptions
	// contains filtered or unexported fields
}

ConfigOptions holds cli, file, and resolved global configuration.

func NewConfigOptions

func NewConfigOptions(stdio *genericclioptions.StdioOptions) *ConfigOptions

NewConfigOptions initializes ConfigOptions with default values.

func (*ConfigOptions) Complete

func (o *ConfigOptions) Complete() error

func (*ConfigOptions) Resolved

func (o *ConfigOptions) Resolved() *ResolvedConfig

func (*ConfigOptions) Run

func (*ConfigOptions) Validate

func (*ConfigOptions) Validate() error

type CreateOptions

type CreateOptions struct {
	*genericclioptions.StdioOptions
	// contains filtered or unexported fields
}

CreateOptions have the data required to perform the create operation.

func NewCreateOptions

func NewCreateOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *CreateOptions

NewCreateOptions initializes the options struct.

func (*CreateOptions) Complete

func (o *CreateOptions) Complete() error

func (*CreateOptions) Run

func (o *CreateOptions) Run(ctx context.Context, _ ...string) error

func (*CreateOptions) Validate

func (o *CreateOptions) Validate() error

type CustomImporter

type CustomImporter struct {
	NameIndex    *int  `json:"name,omitempty"`   // NameIndex is the index of the name column.
	SecretIndex  *int  `json:"secret,omitempty"` // SecretIndex is the index of the secret column.
	LabelIndexes []int `json:"labels,omitempty"` // LabelIndexes are the indexes of the label columns.
}

CustomImporter defines custom column indexes used to extract fields from a CSV row.

func (CustomImporter) String

func (ic CustomImporter) String() string

type DefaultVltOptions

type DefaultVltOptions struct {
	*genericclioptions.StdioOptions
	// contains filtered or unexported fields
}

func NewDefaultVltOptions

func NewDefaultVltOptions(iostreams *genericclioptions.IOStreams, vaultOptions *VaultOptions) *DefaultVltOptions

func (*DefaultVltOptions) Complete

func (o *DefaultVltOptions) Complete() error

func (*DefaultVltOptions) Run

func (o *DefaultVltOptions) Run(ctx context.Context, args ...string) error

func (*DefaultVltOptions) Validate

func (o *DefaultVltOptions) Validate() error

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) String

func (d Duration) String() string

type ExportError

type ExportError struct {
	Err error
}

func (*ExportError) Error

func (e *ExportError) Error() string

func (*ExportError) Unwrap

func (e *ExportError) Unwrap() error

type ExportOptions

type ExportOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

func NewExportOptions

func NewExportOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *ExportOptions

NewExportOptions initializes the options struct.

func (*ExportOptions) Complete

func (*ExportOptions) Complete() error

func (*ExportOptions) Run

func (o *ExportOptions) Run(ctx context.Context, _ ...string) (retErr error)

func (*ExportOptions) Validate

func (o *ExportOptions) Validate() error

type FileConfig

type FileConfig struct {
	Vault     VaultConfig      `toml:"vault" json:"vault"`
	Clipboard *ClipboardConfig `` /* 136-byte string literal not displayed */
	Hooks     *HooksConfig     `toml:"hooks" comment:"Optional lifecycle hooks for vault events" json:"hooks"`
	// contains filtered or unexported fields
}

FileConfig represents the full structure of the configuration file,

func LoadFileConfig

func LoadFileConfig(path string) (*FileConfig, error)

LoadFileConfig loads the config from the given or default path.

type Filter

type Filter int
const (
	FilterByID Filter
	FilterByName
	FilterByLabels
)

func (Filter) Help

func (u Filter) Help() string

type FindError

type FindError struct {
	Err error
}

func (*FindError) Error

func (e *FindError) Error() string

func (*FindError) Unwrap

func (e *FindError) Unwrap() error

type FindOptions

type FindOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

FindOptions holds data required to run the command.

func NewFindOptions

func NewFindOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions, config *ResolvedConfig) *FindOptions

NewFindOptions initializes the options struct.

func (*FindOptions) Complete

func (o *FindOptions) Complete() error

func (*FindOptions) Run

func (o *FindOptions) Run(ctx context.Context, args ...string) (retErr error)

func (*FindOptions) Validate

func (o *FindOptions) Validate() error

type Flags

type Flags struct {
	// contains filtered or unexported fields
}

Flags holds cli overrides for configuration.

type GenerateOptions

type GenerateOptions struct {
	*genericclioptions.StdioOptions
	// contains filtered or unexported fields
}

func NewGenerateOptions

func NewGenerateOptions(stdio *genericclioptions.StdioOptions) *GenerateOptions

NewGenerateOptions initializes the options struct.

func (*GenerateOptions) Complete

func (*GenerateOptions) Complete() error

func (*GenerateOptions) Run

func (*GenerateOptions) Validate

func (*GenerateOptions) Validate() error

type HooksConfig

type HooksConfig struct {
	PostLoginCmd []string `toml:"post_login_cmd,commented" comment:"Command to run after a successful login" json:"post_login_cmd"`
	PostWriteCmd []string `` /* 131-byte string literal not displayed */
}

HooksConfig defines optional lifecycle hooks triggered by vault events.

type ImportError

type ImportError struct {
	Err error
}

func (*ImportError) Error

func (e *ImportError) Error() string

func (*ImportError) Unwrap

func (e *ImportError) Unwrap() error

type ImportOptions

type ImportOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

func NewImportOptions

func NewImportOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *ImportOptions

NewImportOptions initializes the options struct.

func (*ImportOptions) Complete

func (o *ImportOptions) Complete() error

func (*ImportOptions) Run

func (o *ImportOptions) Run(ctx context.Context, files ...string) (retErr error)

func (*ImportOptions) Validate

func (*ImportOptions) Validate() error

type Importer

type Importer interface {
	// contains filtered or unexported methods
}

type LoginOptions

type LoginOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

LoginOptions holds data required to run the command.

func NewLoginOptions

func NewLoginOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions, config *ResolvedConfig) *LoginOptions

NewLoginOptions initializes the options struct.

func (*LoginOptions) Close

func (o *LoginOptions) Close() error

func (*LoginOptions) Complete

func (o *LoginOptions) Complete() error

func (*LoginOptions) Run

func (o *LoginOptions) Run(ctx context.Context, _ ...string) error

func (*LoginOptions) Validate

func (o *LoginOptions) Validate() error

type LogoutOptions

type LogoutOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

func NewLogoutOptions

func NewLogoutOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *LogoutOptions

NewLogoutOptions initializes the options struct.

func (*LogoutOptions) Close

func (o *LogoutOptions) Close() error

func (*LogoutOptions) Complete

func (o *LogoutOptions) Complete() error

func (*LogoutOptions) Run

func (o *LogoutOptions) Run(ctx context.Context, _ ...string) error

func (*LogoutOptions) Validate

func (*LogoutOptions) Validate() error

type RemoveError

type RemoveError struct {
	Err error
}

func (*RemoveError) Error

func (e *RemoveError) Error() string

func (*RemoveError) Unwrap

func (e *RemoveError) Unwrap() error

type RemoveOptions

type RemoveOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

RemoveOptions holds data required to run the command.

func NewRemoveOptions

func NewRemoveOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *RemoveOptions

NewRemoveOptions initializes the options struct.

func (*RemoveOptions) Complete

func (o *RemoveOptions) Complete() error

func (*RemoveOptions) Run

func (o *RemoveOptions) Run(ctx context.Context, args ...string) (retErr error)

func (*RemoveOptions) Validate

func (o *RemoveOptions) Validate() error

type ResolvedConfig

type ResolvedConfig struct {
	SessionDuration     Duration `json:"session_duration,omitempty"`
	VaultPath           string   `json:"vault_path,omitempty"`
	MaxHistorySnapshots int      `json:"max_history_snapshots"`
	CopyCmd             []string `json:"copy_cmd,omitempty"`
	PasteCmd            []string `json:"paste_cmd,omitempty"`
	PostLoginCmd        []string `json:"post_login_cmd,omitempty"`
	PostWriteCmd        []string `json:"post_write_cmd,omitempty"`
	// contains filtered or unexported fields
}

ResolvedConfig contains the final merged configuration. cli flags take precedence over config file values.

type RotateError

type RotateError struct {
	Err error
}

func (*RotateError) Error

func (e *RotateError) Error() string

func (*RotateError) Unwrap

func (e *RotateError) Unwrap() error

type RotateOptions

type RotateOptions struct {
	*genericclioptions.StdioOptions
	// contains filtered or unexported fields
}

RotateOptions have the data required to perform the create operation.

func NewRotateOptions

func NewRotateOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *RotateOptions

NewRotateOptions initializes the options struct.

func (*RotateOptions) Complete

func (o *RotateOptions) Complete() error

func (*RotateOptions) Run

func (o *RotateOptions) Run(ctx context.Context, _ ...string) (retErr error)

func (*RotateOptions) Validate

func (o *RotateOptions) Validate() error

type SaveError

type SaveError struct {
	Err error
}

func (*SaveError) Error

func (e *SaveError) Error() string

func (*SaveError) Unwrap

func (e *SaveError) Unwrap() error

type SaveOptions

type SaveOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

SaveOptions holds data required to run the command.

func NewSaveOptions

func NewSaveOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *SaveOptions

NewSaveOptions initializes the options struct.

func (*SaveOptions) Complete

func (*SaveOptions) Complete() error

func (*SaveOptions) Run

func (o *SaveOptions) Run(ctx context.Context, _ ...string) (retErr error)

func (*SaveOptions) Validate

func (o *SaveOptions) Validate() error

type SearchableOptions

type SearchableOptions struct {
	ID       int
	IDs      []int
	Name     string
	Labels   []string
	Wildcard string
}

SearchableOptions provides common filtering parameters and methods used by CLI commands for querying secrets.

func NewSearchableOptions

func NewSearchableOptions(opts ...SearchableOptionsOpt) *SearchableOptions

func (*SearchableOptions) Complete

func (*SearchableOptions) Complete() error

func (*SearchableOptions) Validate

func (*SearchableOptions) Validate() error

func (*SearchableOptions) WildcardFrom

func (o *SearchableOptions) WildcardFrom(args []string)

type SearchableOptionsOpt

type SearchableOptionsOpt func(*SearchableOptions)

type ShowError

type ShowError struct {
	Err error
}

func (*ShowError) Error

func (e *ShowError) Error() string

func (*ShowError) Unwrap

func (e *ShowError) Unwrap() error

type ShowOptions

type ShowOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

ShowOptions holds data required to run the command.

func NewShowOptions

func NewShowOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *ShowOptions

NewShowOptions initializes the options struct.

func (*ShowOptions) Complete

func (o *ShowOptions) Complete() error

func (*ShowOptions) Run

func (o *ShowOptions) Run(ctx context.Context, args ...string) error

Run performs a secret lookup and outputs the result based on user flags.

func (*ShowOptions) Validate

func (o *ShowOptions) Validate() error

type UpdateError

type UpdateError struct {
	Err error
}

func (*UpdateError) Error

func (e *UpdateError) Error() string

func (*UpdateError) Unwrap

func (e *UpdateError) Unwrap() error

type UpdateOptions

type UpdateOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

func NewUpdateOptions

func NewUpdateOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *UpdateOptions

NewUpdateOptions initializes the options struct.

func (*UpdateOptions) Complete

func (*UpdateOptions) Complete() error

func (*UpdateOptions) Run

func (o *UpdateOptions) Run(ctx context.Context, args ...string) (retErr error)

func (*UpdateOptions) Validate

func (o *UpdateOptions) Validate() error

type UpdateSecretValueOptions

type UpdateSecretValueOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
	// contains filtered or unexported fields
}

func NewUpdateSecretValueOptions

func NewUpdateSecretValueOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *UpdateSecretValueOptions

NewUpdateSecretValueOptions initializes the options struct.

func (*UpdateSecretValueOptions) Complete

func (*UpdateSecretValueOptions) Complete() error

func (*UpdateSecretValueOptions) Run

func (o *UpdateSecretValueOptions) Run(ctx context.Context, args ...string) (retErr error)

func (*UpdateSecretValueOptions) UpdateSecretValue

func (o *UpdateSecretValueOptions) UpdateSecretValue(ctx context.Context, id int, secret []byte) error

func (*UpdateSecretValueOptions) Validate

func (o *UpdateSecretValueOptions) Validate() error

type VacuumOptions

type VacuumOptions struct {
	*genericclioptions.StdioOptions
	*VaultOptions
}

func NewVacuumOptions

func NewVacuumOptions(stdio *genericclioptions.StdioOptions, vaultOptions *VaultOptions) *VacuumOptions

NewVacuumOptions initializes the options struct.

func (*VacuumOptions) Complete

func (*VacuumOptions) Complete() error

func (*VacuumOptions) Run

func (o *VacuumOptions) Run(ctx context.Context, _ ...string) error

func (*VacuumOptions) Validate

func (*VacuumOptions) Validate() error

type VaultConfig

type VaultConfig struct {
	Path                string `toml:"path,commented" comment:"Vlt database path (default: '~/.vlt' if not set)" json:"path,omitempty"`
	SessionDuration     string `` /* 147-byte string literal not displayed */
	MaxHistorySnapshots *int   `` /* 173-byte string literal not displayed */
}

VaultConfig holds vault-related configuration.

type VaultOptions

type VaultOptions struct {
	// contains filtered or unexported fields
}

func NewVaultOptions

func NewVaultOptions(opts ...VaultOptionsOpts) *VaultOptions

NewVaultOptions creates a new VaultOptions with provided configurations. It will open an existing vault or create a new one if [WithLazyLoad] is enabled.

func (*VaultOptions) Complete

func (*VaultOptions) Complete() error

func (*VaultOptions) Open

Run initializes the Vault object from the specified existing file.

func (*VaultOptions) Validate

func (*VaultOptions) Validate() error

type VaultOptionsOpts

type VaultOptionsOpts func(*VaultOptions)

type VltImporter

type VltImporter struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL