cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFinderOpts

func NewFinderOpts(zk *zk.Zk, filtering Filtering, sorting Sorting) (*note.FinderOpts, error)

NewFinderOpts creates an instance of note.FinderOpts from a set of user flags.

Types

type Container

type Container struct {
	Date     date.Provider
	Logger   util.Logger
	Terminal *term.Terminal
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer() *Container

func (*Container) Database

func (c *Container) Database(zk *zk.Zk, forceIndexing bool) (*sqlite.DB, note.IndexingStats, error)

Database returns the DB instance for the given notebook, after executing any pending migration and indexing the notes if needed.

func (*Container) NoteFinder

func (c *Container) NoteFinder(tx sqlite.Transaction, opts fzf.NoteFinderOpts) *fzf.NoteFinder

func (*Container) NoteIndexer added in v0.2.0

func (c *Container) NoteIndexer(tx sqlite.Transaction) *sqlite.NoteIndexer

func (*Container) OpenZk

func (c *Container) OpenZk() (*zk.Zk, error)

func (*Container) Paginate

func (c *Container) Paginate(noPager bool, config zk.Config, run func(out io.Writer) error) error

Paginate creates an auto-closing io.Writer which will be automatically paginated if noPager is false, using the user's pager.

You can write to the pager only in the run callback.

func (*Container) Parser

func (c *Container) Parser(zk *zk.Zk) *markdown.Parser

func (*Container) TemplateLoader

func (c *Container) TemplateLoader(lang string) *handlebars.Loader

type Edit

type Edit struct {
	Force bool `short:f help:"Do not confirm before editing many notes at the same time."`

	Filtering
	Sorting
}

Edit opens notes matching a set of criteria with the user editor.

func (*Edit) Run

func (cmd *Edit) Run(container *Container) error

type Filtering

type Filtering struct {
	Path []string `group:filter arg optional placeholder:PATH help:"Find notes matching the given path, including its descendants."`

	Interactive    bool     `group:filter short:i                     help:"Select notes interactively with fzf."`
	Limit          int      `group:filter short:n   placeholder:COUNT help:"Limit the number of notes found."`
	Match          string   `group:filter short:m   placeholder:QUERY help:"Terms to search for in the notes."`
	Exclude        []string `group:filter short:x   placeholder:PATH  help:"Ignore notes matching the given path, including its descendants."`
	Tag            []string `group:filter short:t                     help:"Find notes tagged with the given tags."`
	Mention        []string `group:filter           placeholder:PATH  help:"Find notes mentioning the title of the given ones."`
	LinkedBy       []string `group:filter short:l   placeholder:PATH  help:"Find notes which are linked by the given ones."       xor:link`
	NoLinkedBy     []string `group:filter           placeholder:PATH  help:"Find notes which are not linked by the given ones."   xor:link`
	LinkTo         []string `group:filter short:L   placeholder:PATH  help:"Find notes which are linking to the given ones."      xor:link`
	NoLinkTo       []string `group:filter           placeholder:PATH  help:"Find notes which are not linking to the given notes." xor:link`
	Orphan         bool     `group:filter                             help:"Find notes which are not linked by any other note."   xor:link`
	Related        []string `group:filter           placeholder:PATH  help:"Find notes which might be related to the given ones." xor:link`
	MaxDistance    int      `group:filter           placeholder:COUNT help:"Maximum distance between two linked notes."`
	Recursive      bool     `group:filter short:r                     help:"Follow links recursively."`
	Created        string   `group:filter           placeholder:DATE  help:"Find notes created on the given date."`
	CreatedBefore  string   `group:filter           placeholder:DATE  help:"Find notes created before the given date."`
	CreatedAfter   string   `group:filter           placeholder:DATE  help:"Find notes created after the given date."`
	Modified       string   `group:filter           placeholder:DATE  help:"Find notes modified on the given date."`
	ModifiedBefore string   `group:filter           placeholder:DATE  help:"Find notes modified before the given date."`
	ModifiedAfter  string   `group:filter           placeholder:DATE  help:"Find notes modified after the given date."`
}

Filtering holds filtering options to select notes.

type Index

type Index struct {
	Force bool `short:"f" help:"Force indexing all the notes."`
	Quiet bool `short:"q" help:"Do not print statistics nor progress."`
}

Index indexes the content of all the notes in the notebook.

func (*Index) Help

func (cmd *Index) Help() string

func (*Index) Run

func (cmd *Index) Run(container *Container) error

type Init

type Init struct {
	Directory string `arg optional type:"path" default:"." help:"Directory containing the notebook."`
}

Init creates a notebook in the given directory

func (*Init) Run

func (cmd *Init) Run() error

type List

type List struct {
	Format     string `group:format short:f placeholder:TEMPLATE help:"Pretty print the list using the given format."`
	Delimiter  string "group:format short:d default:\n             help:\"Print notes delimited by the given separator.\""
	Delimiter0 bool   "" /* 156-byte string literal not displayed */
	NoPager    bool   `group:format short:P help:"Do not pipe output into a pager."`
	Quiet      bool   `group:format short:q help:"Do not print the total number of notes found."`

	Filtering
	Sorting
}

List displays notes matching a set of criteria.

func (*List) Run

func (cmd *List) Run(container *Container) error

type New

type New struct {
	Directory string `arg optional type:"path" default:"." help:"Directory in which to create the note."`

	Title     string            `short:t   placeholder:TITLE help:"Title of the new note."`
	Group     string            `` /* 132-byte string literal not displayed */
	Extra     map[string]string `                            help:"Extra variables passed to the templates." mapsep:","`
	Template  string            `type:path placeholder:PATH  help:"Custom template used to render the note."`
	PrintPath bool              `short:p                     help:"Print the path of the created note instead of editing it."`
}

New adds a new note to the notebook.

func (*New) ConfigOverrides

func (cmd *New) ConfigOverrides() zk.ConfigOverrides

func (*New) Run

func (cmd *New) Run(container *Container) error

type Sorting

type Sorting struct {
	Sort []string `group:sort short:s placeholder:TERM help:"Order the notes by the given criterion."`
}

Sorting holds sorting options to order notes.

Jump to

Keyboard shortcuts

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