commands

package
v0.0.0-...-6c1a4b7 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Version specifies the number for the version subcommand
	Version = "24.2"
)

Variables

View Source
var CloseDatabase = closeDatabase

CloseDatabase opens the database before running a subcommand.

View Source
var Command = exec.Command

Command returns the Cmd struct to execute the named program

View Source
var GeneratePassword = password.Generate

GeneratePassword is the package shortcut for password.Generator.Generate.

View Source
var GenerateQrCode = qrterminal.Generate

GenerateQrCode creates a QR Code and writes it out to io.Writer.

View Source
var GenerateTotpCode = totp.GenerateCode

GenerateTotpCode creates a TOTP token using the current time.

View Source
var OpenDatabase = openDatabase

OpenDatabase opens the database before running a subcommand.

View Source
var Remove = os.Remove

Remove removes the named file or (empty) directory.

View Source
var Stat = os.Stat

Stat returns a FileInfo describing the named file.

Functions

func Main

func Main(input io.Reader, output io.Writer) int

Main is the commandline interface to this package.

func NewRootCommand

func NewRootCommand(ctx *Context) *cobra.Command

NewRootCommand creates the parent of all subcommands.

Types

type Context

type Context struct {
	TempFile         *os.File
	PermanentPath    string
	Database         *sql.DB
	NoWriteBack      bool
	DryRun           bool
	DatabaseMigrated bool
	OutOrStdout      *io.Writer
}

Context is state that is preserved during PreRun / Run / PostRun.

type PasswordType

type PasswordType string

PasswordType is an enum of possible password types.

const (
	// PasswordTypePlain is a password sent to a server as-is.
	PasswordTypePlain PasswordType = "plain"
	// PasswordTypeTotp is a TOTP shared secret.
	PasswordTypeTotp PasswordType = "totp"
)

func (*PasswordType) Set

func (t *PasswordType) Set(v string) error

Set sets the value of `t` from `v`.

func (*PasswordType) String

func (t *PasswordType) String() string

func (*PasswordType) Type

func (t *PasswordType) Type() string

Type returns the type of `t` as a string.

type XMLMachine

type XMLMachine struct {
	XMLName  xml.Name     `xml:"node"`
	Label    string       `xml:"label,attr"`
	Services []XMLService `xml:"node"`
}

XMLMachine is the 1st <node> element from cpm's XML database.

type XMLMachines

type XMLMachines struct {
	XMLName  xml.Name     `xml:"root"`
	Machines []XMLMachine `xml:"node"`
}

XMLMachines is the <root> element from cpm's XML database.

type XMLPassword

type XMLPassword struct {
	XMLName xml.Name `xml:"node"`
	Label   string   `xml:"label,attr"`
	Totp    string   `xml:"totp,attr"`
}

XMLPassword is the 4th <node> element from cpm's XML database.

type XMLService

type XMLService struct {
	XMLName xml.Name  `xml:"node"`
	Label   string    `xml:"label,attr"`
	Users   []XMLUser `xml:"node"`
}

XMLService is the 2nd <node> element from cpm's XML database.

type XMLUser

type XMLUser struct {
	XMLName   xml.Name      `xml:"node"`
	Label     string        `xml:"label,attr"`
	Passwords []XMLPassword `xml:"node"`
}

XMLUser is the 3rd <node> element from cpm's XML database.

Jump to

Keyboard shortcuts

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