cmd

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ListAll     = false
	ListDone    = false
	ListCommand = &cli.Command{
		Name:     "list",
		Aliases:  []string{"l"},
		Usage:    "List all todo items",
		Category: "Tasks",
		Before:   ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertAutoSychronization, ctx.OptionalId),
		Flags: []cli.Flag{
			&cli.IntFlag{
				Name:     "id",
				Aliases:  []string{"i"},
				Usage:    "List a specific item",
				Required: false,
			},
			&cli.BoolFlag{
				Name:    "all",
				Aliases: []string{"a"},
				Usage:   "List all tasks",
			},
			&cli.BoolFlag{
				Name:    "done",
				Aliases: []string{"d"},
				Usage:   "List all done tasks",
			},
			&cli.BoolFlag{
				Name:    "pending",
				Aliases: []string{"p"},
				Usage:   "List all pending tasks",
			},
			&cli.StringSliceFlag{
				Name:    "tags",
				Aliases: []string{"t"},
				Usage:   "List all tasks with the specified tags",
			},
			&cli.BoolFlag{
				Name:  "no-header",
				Usage: "Do not print the header",
			},
		},
		Action: ActionList,
	}
)
View Source
var (
	AppName        = "todo-cli"
	Version        = "0.0.1"
	BuildHost      = "dev"
	BuildDate      = "2021-08-01T00:00:00Z"
	AppDescription = AppName + " v" + Version
)
View Source
var (
	ActCommand = &cli.Command{
		Name:      "act",
		Usage:     "Set current timestamp as action for item",
		Aliases:   []string{"a"},
		Before:    ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertAutoSychronization),
		Action:    ActionAct,
		ArgsUsage: "[todo-id]",
		Category:  "Tasks",
		After:     ctx.ChainedContext(ctx.AssertSave, ctx.AssertAutoSychronization),
	}
)
View Source
var (
	AddCommand = &cli.Command{
		Name:     "add",
		Usage:    "Add a new todo item",
		Aliases:  []string{"a"},
		Before:   ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertAutoSychronization),
		Action:   ActionAdd,
		Category: "Tasks",
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:     "title",
				Aliases:  []string{"t"},
				Usage:    "Title of the task",
				Required: true,
			},
			&cli.TimestampFlag{
				Name:     "due-date",
				Aliases:  []string{"d"},
				Usage:    "Due date for the todo item",
				Layout:   "2006-01-02",
				Required: false,
			},
			&cli.StringSliceFlag{
				Name:     "tags",
				Usage:    "Tags for the todo item",
				Required: false,
			},
			&cli.IntFlag{
				Name:     "parent-id",
				Usage:    "Parent ID for the todo item",
				Required: false,
				Aliases:  []string{"p"},
			},
		},
		After: ctx.ChainedContext(ctx.AssertSave, ctx.AssertSychronization),
	}
)
View Source
var (
	BackupCommand = &cli.Command{
		Name:     "backup",
		Usage:    "Run a backup of the todo list",
		Aliases:  []string{"a"},
		Before:   ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertAutoSychronization),
		Category: "Tasks",
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:     "path",
				Aliases:  []string{"p"},
				Usage:    "Path to backup directory",
				Required: false,
				Value:    path.Join(ctx.GetDefaultDataFolder(), "backup"),
			},
		},
		Subcommands: []*cli.Command{
			{
				Name:   "run",
				Usage:  "Run a backup of the todo list",
				Action: ActionBackupRun,
			},
			{
				Name:   "list",
				Usage:  "List all backups",
				Action: ActionBackupList,
			},
		},
	}
)
View Source
var (
	CompleteCommand = &cli.Command{
		Name:      "complete",
		Usage:     "Complete a todo item",
		Aliases:   []string{"c"},
		Action:    ActionComplete,
		Category:  "Tasks",
		ArgsUsage: "[todo-id]",
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:    "undo",
				Aliases: []string{"u"},
				Usage:   "Undo a completed todo item",
			},
		},
		Before: ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertValidId),
		After:  ctx.ChainedContext(ctx.AssertSave, ctx.AssertAutoSychronization),
	}
)
View Source
var (
	DeleteCommand = &cli.Command{
		Name:     "delete",
		Usage:    "Delete a todo item",
		Aliases:  []string{"d"},
		Action:   ActionDelete,
		Category: "Tasks",
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:    "force",
				Aliases: []string{"f"},
				Usage:   "Force delete without confirmation",
			},
		},
		Before: ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertValidId),
		After:  ctx.ChainedContext(ctx.AssertSave, ctx.AssertAutoSychronization),
	}
)
View Source
var (
	InitCommand = &cli.Command{
		Name:  "init",
		Usage: "Outputs the shell initialization script",

		Category: "Tasks",
		Subcommands: []*cli.Command{
			{
				Name:   "bash",
				Action: ActionInitBash},
			{
				Name:   "ps1",
				Action: ActionInitPs1,
				Flags: []cli.Flag{
					&cli.IntFlag{
						Name:  "period",
						Usage: "Period in seconds to show notifications",
						Value: 60,
					},
				},
			},
		},
	}
)
View Source
var (
	NotifyCommand *cli.Command
)
View Source
var (
	SetupCommand *cli.Command
)
View Source
var (
	SyncCommand = &cli.Command{
		Name:     "sync",
		Usage:    "Synchronize local collection with GIST",
		Aliases:  []string{"s"},
		Action:   ActionSync,
		Category: "Setup",
		Before:   ctx.ChainedContext(ctx.AssertLocalConfig),
		After:    ctx.AssertSave,
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:     "simulate",
				Usage:    "Just for testing",
				Required: false,
			},
		},
	}
)
View Source
var (
	UpdateCommand = &cli.Command{
		Name:     "update",
		Usage:    "Update a todo item",
		Aliases:  []string{"u"},
		Action:   ActionUpdate,
		Category: "Tasks",
		Before:   ctx.ChainedContext(ctx.AssertLocalConfig, ctx.AssertValidId),
		Flags: []cli.Flag{
			&cli.IntFlag{
				Name:     "id",
				Aliases:  []string{"i"},
				Usage:    "ID of the task",
				Required: true,
			},
			&cli.StringFlag{
				Name:     "title",
				Usage:    "Title of the task",
				Required: false,
			},
			&cli.TimestampFlag{
				Name:     "due-date",
				Aliases:  []string{"d"},
				Usage:    "Due date for the todo item",
				Layout:   "2006-01-02",
				Required: false,
			},
			&cli.StringSliceFlag{
				Name:     "tags",
				Aliases:  []string{"t"},
				Usage:    "Tags for the todo item",
				Required: false,
			},
			&cli.IntFlag{
				Name:     "parent-id",
				Usage:    "Parent ID for the todo item",
				Required: false,
				Aliases:  []string{"p"},
			},
		},
		After: ctx.ChainedContext(ctx.AssertSave, ctx.AssertSychronization),
	}
)

Functions

func ActionAct

func ActionAct(c *cli.Context) error

func ActionAdd

func ActionAdd(c *cli.Context) error

func ActionBackupList

func ActionBackupList(c *cli.Context) error

func ActionBackupRun

func ActionBackupRun(c *cli.Context) error

func ActionComplete

func ActionComplete(c *cli.Context) error

func ActionDelete

func ActionDelete(c *cli.Context) error

func ActionInitBash

func ActionInitBash(c *cli.Context) error

func ActionInitPs1

func ActionInitPs1(c *cli.Context) error

func ActionList

func ActionList(c *cli.Context) error

func ActionNotify

func ActionNotify(c *cli.Context) error

func ActionSetupBackup

func ActionSetupBackup(c *cli.Context) error

func ActionSetupNew

func ActionSetupNew(c *cli.Context) (err error)

func ActionSetupShell

func ActionSetupShell(c *cli.Context) error

func ActionSetupShow

func ActionSetupShow(c *cli.Context) error

func ActionSetupSync

func ActionSetupSync(c *cli.Context) error

func ActionSync

func ActionSync(c *cli.Context) error

func ActionUpdate

func ActionUpdate(c *cli.Context) error

func App

func App() *cli.App

func GetCommandSetupBackup

func GetCommandSetupBackup() *cli.Command

func GetCommandSetupNew

func GetCommandSetupNew() *cli.Command

func GetCommandSetupShell

func GetCommandSetupShell() *cli.Command

func GetCommandSetupShow

func GetCommandSetupShow() *cli.Command

func GetCommandSetupSync

func GetCommandSetupSync() *cli.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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