config

package
v0.0.0-...-79c0da1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetConfigPath = func() string {
	const configBase = ".config/.tdconfig.json"

	usr, err := os.UserHomeDir()
	if err != nil {
		log.Fatalln(err)
	}

	return filepath.Join(usr, configBase)
}
View Source
var GetLocalPath = func() string {
	path, err := os.Getwd()
	if err != nil {
		log.Fatalln(err)
	}
	return path
}

Functions

func GenerateUniqueSha

func GenerateUniqueSha() string

* Generates a 7 character ID.

func GetContentByEditor

func GetContentByEditor(content string) string

func GetIndexOfListBySha

func GetIndexOfListBySha(list []TodoModel, sha string) int

func GetListBasedOnScope

func GetListBasedOnScope(scope flags.Scope, conf *TdConfig) *[]TodoModel

func WriteConfig

func WriteConfig(conf TdConfig)

Types

type LocalModel

type LocalModel struct {
	Path  string
	Items []TodoModel
}

func GetLocalModelByPath

func GetLocalModelByPath(conf *TdConfig, path string) *LocalModel

* Returns a `LocalModel` from based on path. Creates one if there isn't one with the given path.

type TdConfig

type TdConfig struct {
	Globals []TodoModel
	Locals  []LocalModel
}

func ReadConfig

func ReadConfig() TdConfig

type TodoModel

type TodoModel struct {
	Id         string
	Content    string
	Resolved   bool
	CreatedAt  time.Time
	ResolvedAt *time.Time `json:"ResolvedAt,omitempty"`
}

Jump to

Keyboard shortcuts

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