actions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 16 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.LocalConfigRequired, ctx.AssertAutoSychronization, ctx.OptionalId),
		Flags: []cli.Flag{
			&cli.IntFlag{
				Name:     "id",
				Usage:    "List a specific item",
				Required: false,
			},
			&cli.BoolFlag{
				Name:  "all",
				Usage: "List all tasks",
			},
			&cli.BoolFlag{
				Name:  "done",
				Usage: "List all done tasks",
			},
			&cli.BoolFlag{
				Name:  "pending",
				Usage: "List all pending tasks",
			},
			&cli.StringSliceFlag{
				Name:  "tags",
				Usage: "List all tasks with the specified tags",
			},
			&cli.BoolFlag{
				Name:  "no-header",
				Usage: "Do not print the header",
			},
		},
		Action: ActionList,
	}
)
View Source
var (
	ActCommand = &cli.Command{
		Name:  "act",
		Usage: "Set current timestamp as action for item",
		Before: ctx.ChainedContext(ctx.LocalConfigRequired,
			ctx.AssertAutoSychronization,
			ctx.RequiredTodoId),
		Action:    ActionAct,
		ArgsUsage: "[todo-id]",
		Category:  "Tasks",
		After: ctx.ChainedContext(
			ctx.AssertSave,
			ctx.AssertAutoSychronization),
	}
)
View Source
var ActionInitSh string
View Source
var (
	AddCommand = &cli.Command{
		Name:  "add",
		Usage: "Add a new todo item",
		Before: ctx.ChainedContext(
			ctx.LocalConfigRequired,
			ctx.AssertAutoSychronization),
		Action:   ActionAdd,
		Category: "Tasks",
		Flags:    ItemFlags,
		After:    ctx.ChainedContext(ctx.AssertSave, ctx.AssertSychronization),
	}
)
View Source
var (
	AutoCompleteCommand = &cli.Command{
		Name:     "autocomplete",
		Usage:    "autocomplete bash script",
		Action:   ActionAutoComplete,
		Category: "Tasks",
	}
)
View Source
var (
	BackupCommand = &cli.Command{
		Name:     "backup",
		Usage:    "Run a backup of the todo list",
		Before:   ctx.ChainedContext(ctx.LocalConfigRequired, ctx.AssertAutoSychronization),
		Category: "Tasks",
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:     "path",
				Usage:    "Path to backup directory",
				Required: false,
				Value:    path.Join(utils.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",
		Action:    ActionComplete,
		Category:  "Tasks",
		ArgsUsage: "[todo-id]",
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:    "undo",
				Aliases: []string{"u"},
				Usage:   "Undo a completed todo item",
			},
			&cli.BoolFlag{
				Name:    "recursive",
				Aliases: []string{"r"},
				Usage:   "Complete all children of the todo item",
			},
		},
		Before: ctx.ChainedContext(ctx.LocalConfigRequired, ctx.RequiredTodoId),
		After:  ctx.ChainedContext(ctx.AssertSave, ctx.AssertAutoSychronization),
	}
)
View Source
var (
	DeleteCommand = &cli.Command{
		Name:     "delete",
		Usage:    "Delete a todo item",
		Action:   ActionDelete,
		Category: "Tasks",
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:    "force",
				Aliases: []string{"f"},
				Usage:   "Force delete without confirmation",
			},
		},
		Before: ctx.ChainedContext(ctx.LocalConfigRequired, ctx.RequiredTodoId),
		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 ItemFlags = []cli.Flag{
	&cli.StringFlag{
		Name:     "title",
		Usage:    "Title of the task",
		Required: true,
	},
	&cli.TimestampFlag{
		Name:     "due-date",
		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,
	},
}
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",
		Action:   ActionSync,
		Category: "Setup",
		Before:   ctx.ChainedContext(ctx.LocalConfigRequired),
		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",
		Action:   ActionUpdate,
		Category: "Tasks",
		Before:   ctx.ChainedContext(ctx.LocalConfigRequired, ctx.RequiredTodoId),
		Flags: append([]cli.Flag{
			&cli.IntFlag{
				Name:     "id",
				Usage:    "ID of the task",
				Required: true,
			}},
			ItemFlags...,
		),
		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 ActionAutoComplete

func ActionAutoComplete(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) (err 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 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