cmdutil

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Card object
	Card object = iota
	// Entry object
	Entry
	// File object
	File
	// TOTP object
	TOTP
)

Variables

View Source
var (
	// ErrInvalidLength is returned when generating a password/passphrase and the length passed is < 1.
	ErrInvalidLength = errors.New("invalid length")
	// ErrInvalidName is returned when a name is required and received "" or contains "//".
	ErrInvalidName = errors.New("invalid name")
	// ErrInvalidPath is returned when a path is required and received "".
	ErrInvalidPath = errors.New("invalid path")
)

Functions

func BuildBox

func BuildBox(name string, mp *orderedmap.Map) string

BuildBox constructs a responsive box used to display records information.

┌──── Sample ────┐
│ Key  │ Value   │
└────────────────┘

func Erase

func Erase(filename string) error

Erase overwrites the file content with random bytes and then deletes it.

func Exists

func Exists(db *bolt.DB, name string, obj object) error

Exists checks if name or one of its folders is already being used.

Returns an error if a match was found.

func FmtExpires

func FmtExpires(expires string) (string, error)

FmtExpires returns expires formatted.

func MustExist

func MustExist(db *bolt.DB, obj object, allowDir ...bool) cobra.PositionalArgs

MustExist returns an error if a record does not exist or if the name is invalid.

func MustExistLs

func MustExistLs(db *bolt.DB, obj object) cobra.PositionalArgs

MustExistLs is like MustExist but it doesn't fail if there are no arguments or if the user is using the filter flag.

func MustNotExist

func MustNotExist(db *bolt.DB, obj object, allowDir ...bool) cobra.PositionalArgs

MustNotExist returns an error if the record exists or if the name is invalid.

func NormalizeName

func NormalizeName(name string, allowDir ...bool) string

NormalizeName sanitizes the user input name.

func SelectEditor

func SelectEditor() string

SelectEditor returns the editor to use, if none is found it returns vim.

func SetContext

func SetContext(t testing.TB) *bolt.DB

SetContext sets up the testing environment.

It uses t.Cleanup() to close the database connection after the test and all its subtests are completed.

func WatchFile

func WatchFile(filename string, done chan struct{}, errCh chan error)

WatchFile looks for the file initial state and loops until the first modification.

Preferred over fsnotify since this last returns false events with recently created files.

func WriteClipboard added in v0.2.2

func WriteClipboard(cmd *cobra.Command, d time.Duration, field, content string) error

WriteClipboard writes the content to the clipboard and deletes it after "t" if "t" is higher than 0 or if there is a default timeout set in the configuration. Otherwise it does nothing.

Types

type RunEFunc

type RunEFunc func(cmd *cobra.Command, args []string) error

RunEFunc runs a cobra function returning an error.

Directories

Path Synopsis
2fa
Package tfa handles two-factor authentication codes.
Package tfa handles two-factor authentication codes.
add
rm
add
add
ls
rm
add
cat
ls
mv
rm
gen

Jump to

Keyboard shortcuts

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