ls

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:  "ls",
	Usage: "lists entries",
	Description: `
	List all entries from a .kdbx database

	Usage

	./kpcli --keyfile <keyfile> \
			--database <database-filename> \
			[--cachefile <cachefile name>] \
		ls  [--reverse] [--days 10] [--sort-by-col 1|2|3|4]
			; --reverse -> reverse order
			; --sort-by-col 1 -> title | 2 -> history count | 3 -> creation time | 4 -> mod time
			; --days 10 --> shows entries created or modified in the last 10 days

		┌─────┬────────────────────────────┬───────────┬─────────────────────┬─────────────────────┐
		|     | 	     (COL: 1)          |  (COL: 2) |        (COL: 3)     |       (COL: 4)      |
		├─────┬────────────────────────────┬───────────┬─────────────────────┬─────────────────────┤
		│     │ TITLE                      │ HISTORIES │ CREATED             │ MODIFIED            │
		├─────┼────────────────────────────┼───────────┼─────────────────────┼─────────────────────┤
		│   1 │ Root/TestEntry             │ 1         │ 2018-02-20 22:58:02 │ 2018-02-21 11:42:45 │
		│   2 │ Recycle Bin/testentry2     │ 7         │ 2018-03-25 18:52:47 │ 2018-03-25 22:24:48 │
		└─────┴────────────────────────────┴───────────┴─────────────────────┴─────────────────────┘

	Example:
		kpcli ls --sortby-col 4 -d 2
			; shows entries modified in last 2 days ORDER by col 4(modified time)

		kpcli \
		--keyfile ./tmp/master-db.key \
		--pass 'super_secret' \
		--db ./tmp/master-db.kdbx \
		ls


	`,

	Action: runLs,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "fields",
			Usage:   "fields list to be displayed",
			Aliases: []string{"f"},
		},
		&cli.BoolFlag{
			Name:    "reverse",
			Usage:   "in reverse order",
			Aliases: []string{"r"},
		},
		&cli.BoolFlag{
			Name:    "quite",
			Usage:   "less verbose",
			Aliases: []string{"q"},
		},
		&cli.StringFlag{
			Name:    "cachefile",
			Usage:   "cache result",
			Aliases: []string{"ca"},
		},
		&cli.BoolFlag{
			Name:    "diff",
			Usage:   "diff against cache",
			Aliases: []string{"di"},
		},
		&cli.StringFlag{
			Name:    "days",
			Usage:   "number of days ; days <= 0 means all",
			Aliases: []string{"d"},
		},
		&cli.StringFlag{
			Name:    "sortby-col",
			Usage:   "sort by column number starting 1",
			Aliases: []string{"sb"},
		},
		&cli.StringFlag{
			Name:    "output-format",
			Usage:   "Output format; available: table, csv, markdown, html",
			Aliases: []string{"of"},
		},
	},
}
View Source
var (
	TimeLayout = "2006-01-02 15:04:05"
)

Functions

func NewDB

func NewDB(opts Options) (*db, error)

NewDB create and return a new kdbx db object

Types

type Interested

type Interested struct {
	Created   time.Time
	Histories int
	KeyValues map[string]string
	Modified  time.Time
	Pass      string
	Tags      string
	Title     string
	User      string
}

type Options

type Options struct {
	CacheFile    string
	Database     string
	Days         int
	Diff         bool
	Fields       string
	Key          string
	OutputFormat string
	Pass         string
	Quite        bool
	Reverse      bool
	Sort         string
	SortbyCol    int
}

func (*Options) String

func (o *Options) String() string

Jump to

Keyboard shortcuts

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