common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package common provides shared helpers for keepass CLI commands.

Index

Examples

Constants

View Source
const (
	ExitCodeGeneric        = 1
	ExitCodeUsage          = 2
	ExitCodeNotInitialized = 3
	ExitCodeUnlockFailed   = 4
)

Variables

This section is empty.

Functions

func IsInteractive

func IsInteractive(in io.Reader) bool

func IsNonInteractive

func IsNonInteractive(cmd *cobra.Command) bool

func LoadManager

func LoadManager() (*manager.Manager, error)

func LoadOrCreateManager

func LoadOrCreateManager() (*manager.Manager, error)

func MapError

func MapError(err error) error

func NewPrompter

func NewPrompter(in io.Reader, out io.Writer) *prompt.Prompter

func ParseTags

func ParseTags(input string) []string
Example
package main

import (
	"fmt"

	"github.com/photowey/keepass/cmd/cmder/common"
)

func main() {
	fmt.Println(common.ParseTags(" code, ops , , prod "))

}
Output:
[code ops prod]

func PrintAuditJSON

func PrintAuditJSON(w io.Writer, report audit.Report) error

func PrintAuditText

func PrintAuditText(w io.Writer, report audit.Report) (int, error)

func PrintConfig

func PrintConfig(w io.Writer, env home.Environment, cfg configs.Config, initialized bool) error

func PrintConfigText

func PrintConfigText(w io.Writer, env home.Environment, cfg configs.Config, initialized bool) (int, error)

func PrintCredentialAuditJSON

func PrintCredentialAuditJSON(w io.Writer, report credentialaudit.Report) error

func PrintCredentialAuditText

func PrintCredentialAuditText(w io.Writer, report credentialaudit.Report) (int, error)

func PrintEntries

func PrintEntries(w io.Writer, entries []vault.Entry)

func PrintEntriesJSON

func PrintEntriesJSON(w io.Writer, entries []vault.Entry) error

func PrintEntry

func PrintEntry(w io.Writer, entry vault.Entry, reveal bool)

func PrintEntryJSON

func PrintEntryJSON(w io.Writer, entry vault.Entry, reveal bool) error

func PromptMasterPassword

func PromptMasterPassword(p *prompt.Prompter) (string, error)

func PromptNewMasterPassword

func PromptNewMasterPassword(p *prompt.Prompter) (string, error)

func UsageError

func UsageError(message string) error

func WithExitCode

func WithExitCode(code int, err error) error

Types

type CLIError

type CLIError struct {
	ExitCode int
	Err      error
}

func (CLIError) Error

func (e CLIError) Error() string

func (CLIError) Unwrap

func (e CLIError) Unwrap() error

Jump to

Keyboard shortcuts

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