ctx

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLocalConfigFile     = "config.yaml"
	DefaultLocalCollectionFile = "todo.yaml"
)

Variables

This section is empty.

Functions

func AssertAutoSychronization

func AssertAutoSychronization(c *cli.Context) error

func AssertLocalConfig

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

Assert configuration exists and is valid

func AssertSave

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

func AssertSychronization

func AssertSychronization(c *cli.Context) error

func AssertValidId

func AssertValidId(c *cli.Context) error

AssertValidId checks if

func ChainedContext

func ChainedContext(funcs ...func(c *cli.Context) error) func(c *cli.Context) error

func GetDefaultDataFolder

func GetDefaultDataFolder() string

func OptionalId

func OptionalId(c *cli.Context) error

Types

type Context

type Context struct {
	DataFolder          string
	LocalConfigFile     string
	LocalCollectionFile string
	LocalConfig         *LocalConfig
	Collection          *todo.ToDoCollection
	Error               error
	ExitMessage         string
	Id                  int // Id is the first argument that is a number
	CurrentToDo         *todo.ToDoItem
	Args                []string // Args is the list of arguments that are not numbers
	CancelSaving        bool
	CancelSync          bool
}

func ContextFromCli

func ContextFromCli(c *cli.Context) *Context

func ContextFromCtx

func ContextFromCtx(c *cli.Context) *Context

func ContextFromDataFolder

func ContextFromDataFolder(dataFolder string) *Context

func (*Context) SetExit

func (c *Context) SetExit(err error, format string, args ...interface{}) error

type LocalConfig

type LocalConfig struct {
	ToDoListName string              `yaml:"todo_list_name"`
	Gist         github.GistConfig   `yaml:"gist"`
	Backup       backup.BackupConfig `yaml:"backup"`
}

func GetDefaultLocalConfig

func GetDefaultLocalConfig(dataFolder string) *LocalConfig

func LoadLocalConfig

func LoadLocalConfig(filename string) (config LocalConfig, err error)

func (*LocalConfig) Save

func (c *LocalConfig) Save(filename string) error

Jump to

Keyboard shortcuts

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