cmd

package
v0.0.0-...-e5c9662 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDateRange = "128d"

Variables

View Source
var AppendCommand = cli.Command{
	Name:    "append",
	Aliases: []string{"a"},
	Usage:   "grep diary",
	Action:  AppendAction,
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "code, c",
			Usage: "append code block",
		},
		cli.StringFlag{
			Name:  "language, g",
			Usage: "code block language",
		},
		cli.IntFlag{
			Name:  "before-append, B",
			Usage: "NUM of blank line to add before content to be append",
			Value: 1,
		},
		cli.IntFlag{
			Name:  "after-append, A",
			Usage: "NUM of blank line to add after content to be append",
			Value: 1,
		},
	},
}
View Source
var ConfigCommand = cli.Command{
	Name:    "config",
	Aliases: []string{"c"},
	Usage:   "modify config",
	Action:  ConfigAction,
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "list, l",
			Usage: "list config",
		},
		cli.StringFlag{
			Name:  "get",
			Usage: "get config value",
		},
	},
}
View Source
var EditCommand = cli.Command{
	Name:      "edit",
	Aliases:   []string{"e"},
	Usage:     "edit diary",
	UsageText: "liary mv [command options...] <file suffix>",
	Action:    EditAction,
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "file, f",
			Usage: "Open specified file",
		},
		cli.StringFlag{
			Name:  "date, d",
			Usage: "Open specified date diary",
		},
		cli.IntFlag{
			Name:  "before, b",
			Usage: "Open specified before diary by day",
		},
		cli.IntFlag{
			Name:  "after, a",
			Usage: "Open specified after diary by day",
		},
	},
}
View Source
var FindCommand = cli.Command{
	Name:    "find",
	Aliases: []string{"f"},
	Usage:   "find and edit diary",
	Action:  FindAction,
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "range, r",
			Usage: "relative date range",
			Value: DefaultDateRange,
		},
		cli.BoolFlag{
			Name:  "all, a",
			Usage: "show all diary's",
		},
	},
}
View Source
var GrepCommand = cli.Command{
	Name:    "grep",
	Aliases: []string{"g"},
	Usage:   "grep diary",
	Action:  GrepAction,
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "range, r",
			Usage: "relative date range",
			Value: DefaultDateRange,
		},
	},
}
View Source
var ListCommand = cli.Command{
	Name:    "list",
	Aliases: []string{"l"},
	Usage:   "list diary",
	Action:  ListAction,
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "fullpath, f",
			Usage: "list only this year",
		},
		cli.StringFlag{
			Name:  "range, r",
			Usage: "relative date range",
			Value: DefaultDateRange,
		},
		cli.BoolFlag{
			Name:  "all, a",
			Usage: "show all diary's",
		},
	},
}
View Source
var MoveCommand = cli.Command{
	Name:      "mv",
	Aliases:   []string{"m"},
	Usage:     "move diary",
	UsageText: "liary mv [command options...] <source file> <dist file>",
	Action:    MoveAction,
	Flags:     []cli.Flag{},
}

Functions

func AppendAction

func AppendAction(c *cli.Context) error

func ConfigAction

func ConfigAction(c *cli.Context) error

func EachField

func EachField(s interface{}, fn EachFunc) error

func EditAction

func EditAction(c *cli.Context) error

func FindAction

func FindAction(c *cli.Context) error

func GrepAction

func GrepAction(c *cli.Context) error

func ListAction

func ListAction(c *cli.Context) error

func MoveAction

func MoveAction(c *cli.Context) error

Types

type EachFunc

type EachFunc func(int, string, interface{}, reflect.Kind)

Jump to

Keyboard shortcuts

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