app

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package app can do various conversions

Package app common objects

Package app handles informational requests

Package app can insert

Package app can get stats

Package app can list entries

Package app can move entries

Package app handles rekeying a database

Package app can remove an entry

Package app can show/clip an entry

Package app handles TOTP tokens.

Package app can unset a field

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTOTP is used when TOTP is requested BUT is disabled
	ErrNoTOTP = errors.New("totp is disabled")
	// ErrUnknownTOTPMode indicates an unknown totp argument type
	ErrUnknownTOTPMode = errors.New("unknown totp mode")
)

Functions

func Conv

func Conv(cmd CommandOptions) error

Conv will convert 1-N files

func Die

func Die(msg string)

Die will print a message and exit (non-zero)

func Info

func Info(w io.Writer, command string, args []string) (bool, error)

Info will report help/bash/env details

func Insert

func Insert(cmd UserInputOptions) error

Insert will execute an insert

func JSON

func JSON(cmd CommandOptions) error

JSON will get entries (1 or ALL) in JSON format

func List

func List(cmd CommandOptions, groups bool) error

List will list/find entries

func Move

func Move(cmd CommandOptions) error

Move is the CLI command to move entries

func ParseTimeWindow added in v1.5.0

func ParseTimeWindow(windows ...string) ([]config.TimeWindow, error)

ParseTimeWindow will handle parsing a window of colors for TOTP operations

func ReKey

func ReKey(cmd UserInputOptions) error

ReKey handles entry rekeying

func Remove

func Remove(cmd CommandOptions) error

Remove will remove an entry

func ShowClip

func ShowClip(cmd CommandOptions, isShow bool) error

ShowClip will handle showing/clipping an entry

func Unset added in v1.6.0

func Unset(cmd CommandOptions) error

Unset enables clearing an entry

Types

type CommandOptions

type CommandOptions interface {
	Confirm(string) bool
	Args() []string
	Transaction() *kdbx.Transaction
	Writer() io.Writer
}

CommandOptions define how commands operate as an application

type DefaultCommand

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

DefaultCommand is the default CLI app type for actual execution

func NewDefaultCommand

func NewDefaultCommand(args []string) (*DefaultCommand, error)

NewDefaultCommand creates a new app command

func (*DefaultCommand) Args

func (a *DefaultCommand) Args() []string

Args will get the args passed to the application

func (*DefaultCommand) Confirm

func (a *DefaultCommand) Confirm(prompt string) bool

Confirm will confirm with the user (dying if something abnormal happens)

func (*DefaultCommand) Input

func (a *DefaultCommand) Input(interactive, isPassword bool, prompt string) ([]byte, error)

Input will read user input

func (*DefaultCommand) IsPipe

func (a *DefaultCommand) IsPipe() bool

IsPipe will indicate if we're receiving pipe input

func (*DefaultCommand) Transaction

func (a *DefaultCommand) Transaction() *kdbx.Transaction

Transaction will return the backend transaction

func (*DefaultCommand) Writer

func (a *DefaultCommand) Writer() io.Writer

Writer will get stdout

type TOTPArguments

type TOTPArguments struct {
	Entry string
	Mode  string
}

TOTPArguments are the parsed TOTP call arguments

func NewTOTPArguments

func NewTOTPArguments(args []string) (*TOTPArguments, error)

NewTOTPArguments will parse the input arguments

func (*TOTPArguments) Do

func (args *TOTPArguments) Do(opts TOTPOptions) error

Do will perform the TOTP operation

type TOTPOptions

type TOTPOptions struct {
	Clear func()
	// contains filtered or unexported fields
}

TOTPOptions are TOTP call options

func NewDefaultTOTPOptions

func NewDefaultTOTPOptions(app CommandOptions) TOTPOptions

NewDefaultTOTPOptions gets the default option set

type UserInputOptions

type UserInputOptions interface {
	CommandOptions
	IsPipe() bool
	Input(bool, bool, string) ([]byte, error)
}

UserInputOptions handle user inputs (e.g. password entry)

Directories

Path Synopsis
Package commands defines available commands within the app
Package commands defines available commands within the app
Package completions generations shell completions
Package completions generations shell completions
Package help manages usage information
Package help manages usage information
Package totp handles TOTP operations
Package totp handles TOTP operations

Jump to

Keyboard shortcuts

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