Documentation ¶
Index ¶
- Constants
- Variables
- func HandleError(err error, exit bool)
- func HandleErrorWithFunc(err error, exit bool, fun ErrorCheckFunc)
- func NewTaskStringer(t Task, stringerType int8) fmt.Stringer
- func Print(a ...interface{})
- func PrintColor(style string, a ...interface{})
- func Printf(format string, a ...interface{})
- func PrintfColor(style, format string, a ...interface{})
- func Println(a ...interface{})
- func PrintlnColor(style string, a ...interface{})
- func ReadInt() (n int)
- func Readln() (str string)
- type Archiver
- type ByDescription
- type ByID
- type ByPriority
- type ByTimestamp
- type Config
- type ConfigManager
- func (m ConfigManager) GetAll() (values map[string]string, err error)
- func (m ConfigManager) GetKeys() (keys []string, err error)
- func (m ConfigManager) GetValueForKey(key string) (value string, err error)
- func (m *ConfigManager) LoadConfig()
- func (m ConfigManager) SetKey(key string, value interface{}) error
- type Database
- type Directory
- func (d Directory) Backup()
- func (d Directory) BackupPath() string
- func (d Directory) Config() ([]byte, error)
- func (d Directory) ConfigPath() string
- func (d Directory) CurrentID() uint32
- func (d Directory) EmptyFetchDir()
- func (d Directory) FetchDir() string
- func (d Directory) IDPath() string
- func (d Directory) IncrementID() uint32
- func (d Directory) Initialize()
- func (d Directory) MetadataDir() string
- func (d Directory) Reset(resetID bool)
- func (d Directory) TasksFilePath() string
- func (d Directory) WriteConfig(config []byte) error
- func (d Directory) WriteID(id uint32)
- type DriveAPI
- type DropboxJSON
- type ErrorCheckFunc
- type FileLogger
- type GoogleDriveJSON
- type JSONDatabase
- type JSONStringer
- type Logger
- type NoneAPI
- type Predicate
- type SimpleStringer
- type SyncAPI
- type Task
- type TaskManager
- func (m TaskManager) Backup()
- func (m TaskManager) DeleteByID(id uint32) error
- func (m TaskManager) GetAll() (tasks []Task, err error)
- func (m TaskManager) GetByID(id uint32) (*Task, error)
- func (m TaskManager) MergeFetchFiles()
- func (m TaskManager) Prune() error
- func (m TaskManager) Reset(resetID bool)
- func (m TaskManager) Save(t Task) error
Constants ¶
const ( LogVerbose = iota LogInfo LogWarning LogError LogNone )
const ( GoogleDrive = iota Dropbox )
const ( LowPriority = 1 NormalPriority = 2 HighPriority = 3 )
const ( Simple = iota JSON )
Variables ¶
var LogLevel = LogInfo
LogLevel represents the lowest level of logging the user wants displayed during the execution of the app
var SynchronizableFiles = []struct { Name, Path string }{ {Name: "tasks.json", Path: GetDirectory().TasksFilePath()}, {Name: "id", Path: GetDirectory().IDPath()}, }
SynchronizableFiles represents each file that will be synchronized
Functions ¶
func HandleError ¶
HandleError will log a non-nil error and if exit is true, then it will exit with an exit code of 1
func HandleErrorWithFunc ¶
func HandleErrorWithFunc(err error, exit bool, fun ErrorCheckFunc)
HandleErrorWithFunc will log a non-nil error if it also satisfies the provided function. If exit is true, it will exit with an exit code of 1
func NewTaskStringer ¶
NewTaskStringer TODO docs
func PrintColor ¶
func PrintColor(style string, a ...interface{})
PrintColor will display a string styled with mgutz/ansi styles with the configured io.Writer
func Printf ¶
func Printf(format string, a ...interface{})
Printf will display a string with the configured io.Writer using the provided format
func PrintfColor ¶
func PrintfColor(style, format string, a ...interface{})
PrintfColor will display a string styled with mgutz/ansi styles with the configured io.Writer using the provided format
func Println ¶
func Println(a ...interface{})
Println will display a string with the configured io.Writer
func PrintlnColor ¶
func PrintlnColor(style string, a ...interface{})
PrintlnColor will display a string styled with mgutz/ansi styles with the configured io.Writer
Types ¶
type ByDescription ¶
type ByDescription []Task
ByDescription TODO docs
func (ByDescription) Len ¶
func (t ByDescription) Len() int
func (ByDescription) Less ¶
func (t ByDescription) Less(i, j int) bool
func (ByDescription) Swap ¶
func (t ByDescription) Swap(i, j int)
type ByPriority ¶
type ByPriority []Task
ByPriority TODO docs
func (ByPriority) Len ¶
func (t ByPriority) Len() int
func (ByPriority) Less ¶
func (t ByPriority) Less(i, j int) bool
func (ByPriority) Swap ¶
func (t ByPriority) Swap(i, j int)
type ByTimestamp ¶
type ByTimestamp []Task
ByTimestamp TODO docs
func (ByTimestamp) Len ¶
func (t ByTimestamp) Len() int
func (ByTimestamp) Less ¶
func (t ByTimestamp) Less(i, j int) bool
func (ByTimestamp) Swap ¶
func (t ByTimestamp) Swap(i, j int)
type Config ¶
type Config struct { GoogleDrive GoogleDriveJSON `json:"googleDrive"` Dropbox DropboxJSON `json:"dropbox"` }
Config TODO docs
type ConfigManager ¶
type ConfigManager struct {
Config Config
}
ConfigManager TODO docs
func (ConfigManager) GetAll ¶
func (m ConfigManager) GetAll() (values map[string]string, err error)
GetAll TODO docs
func (ConfigManager) GetKeys ¶
func (m ConfigManager) GetKeys() (keys []string, err error)
GetKeys TODO docs
func (ConfigManager) GetValueForKey ¶
func (m ConfigManager) GetValueForKey(key string) (value string, err error)
GetValueForKey TODO docs
func (ConfigManager) SetKey ¶
func (m ConfigManager) SetKey(key string, value interface{}) error
SetKey TODO docs
type Database ¶
type Database interface { Read(collection string, v interface{}) error Write(collection string, v interface{}) error }
Database TODO docs
type Directory ¶
Directory represents the Yata directory
func (Directory) Backup ¶
func (d Directory) Backup()
Backup creates a new backup of the current tasks file
func (Directory) BackupPath ¶
BackupPath constructs the path to the next valid backup path
func (Directory) ConfigPath ¶
ConfigPath constructs the path to the config file
func (Directory) EmptyFetchDir ¶
func (d Directory) EmptyFetchDir()
EmptyFetchDir deletes any previously fetched files
func (Directory) IncrementID ¶
IncrementID increments the current ID and returns the result
func (Directory) Initialize ¶
func (d Directory) Initialize()
Initialize will recreate any part of the Yata directory that is missing
func (Directory) MetadataDir ¶
MetadataDir constructs the path to the metadata directory
func (Directory) Reset ¶
Reset deletes current tasks and if resetID is true, will also set the ID back to 0
func (Directory) TasksFilePath ¶
TasksFilePath constructs the path to the tasks file
func (Directory) WriteConfig ¶
WriteConfig writes the entire config file at once
type DriveAPI ¶
type DriveAPI struct {
// contains filtered or unexported fields
}
DriveAPI wraps the Google Drive API within an implementation of the SyncAPI interface
type ErrorCheckFunc ¶
ErrorCheckFunc represents a function that will be used in addition to the nil error check
Example
func (err error) bool { return err != io.EOF }
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
FileLogger TODO docs
type GoogleDriveJSON ¶
type GoogleDriveJSON struct { OAuthToken *oauth2.Token `json:"oauthToken"` SecretFile string `json:"secretFile"` }
GoogleDriveJSON TODO docs URL to generate secret file: https://developers.google.com/drive/v3/web/quickstart/go
type JSONDatabase ¶
type JSONDatabase struct {
// contains filtered or unexported fields
}
JSONDatabase TODO docs
func (JSONDatabase) Read ¶
func (db JSONDatabase) Read(collection string, v interface{}) error
Read TODO docs
func (JSONDatabase) Write ¶
func (db JSONDatabase) Write(collection string, v interface{}) error
type JSONStringer ¶
type JSONStringer struct {
// contains filtered or unexported fields
}
JSONStringer TODO docs
type Logger ¶
type Logger interface { Verbose(string) Info(string) Warning(string) Error(string) Write(int, string) }
Logger provides the contract for logging verbose, info, warning, and error messages using a pre-defined heirarchy
type NoneAPI ¶
type NoneAPI struct{}
NoneAPI represents the lack of a configured synchronization service, so that the nil case does not need handled separately
type SimpleStringer ¶
type SimpleStringer struct {
// contains filtered or unexported fields
}
SimpleStringer TODO docs
type SyncAPI ¶
type SyncAPI interface { Push() Fetch() }
SyncAPI provides the contract necessary for any service that synchronizes yata data
func NewSyncAPI ¶
NewSyncAPI creates a new instance of a synchronization service
type Task ¶
type Task struct { ID uint32 `json:"id"` Description string `json:"desc"` Completed bool `json:"done"` Priority int `json:"priority"` Tags []string `json:"tags"` Timestamp int64 `json:"timestamp"` UUID string `json:"uuid"` }
Task TODO docs
func (*Task) MarshalTask ¶
MarshalTask TODO docs
type TaskManager ¶
TaskManager TODO docs
func (TaskManager) DeleteByID ¶
func (m TaskManager) DeleteByID(id uint32) error
DeleteByID TODO docs
func (TaskManager) GetAll ¶
func (m TaskManager) GetAll() (tasks []Task, err error)
GetAll TODO docs
func (TaskManager) GetByID ¶
func (m TaskManager) GetByID(id uint32) (*Task, error)
GetByID TODO docs
func (TaskManager) MergeFetchFiles ¶
func (m TaskManager) MergeFetchFiles()
MergeFetchFiles TODO docs