utils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DnoteUpdateFilename = ".dnote-upgrade"
View Source
const Version = "0.1.0"

Variables

This section is empty.

Functions

func AskConfirmation

func AskConfirmation(question string) (bool, error)

func ChangeBook added in v0.1.1

func ChangeBook(bookName string) error

ChangeBook replaces the book name in the dnote config file

func CheckFileExists added in v0.1.1

func CheckFileExists(filepath string) bool

CheckFileExists checks if the file exists at the given path

func GenerateConfigFile

func GenerateConfigFile() error

func GenerateNoteID added in v0.1.0

func GenerateNoteID() string

func GetBooks added in v0.1.0

func GetBooks() ([]string, error)

func GetConfigPath

func GetConfigPath() (string, error)

func GetCurrentBook added in v0.1.0

func GetCurrentBook() (string, error)

func GetDnotePath

func GetDnotePath() (string, error)

func GetDnoteUpdatePath

func GetDnoteUpdatePath() (string, error)

func GetYAMLDnoteArchivePath added in v0.1.0

func GetYAMLDnoteArchivePath() (string, error)

func ReadNoteContent added in v0.1.0

func ReadNoteContent() ([]byte, error)

ReadNoteContent reads the content of dnote

func TouchDnoteFile

func TouchDnoteFile() error

func TouchDnoteUpgradeFile

func TouchDnoteUpgradeFile() error

func WriteConfig added in v0.1.0

func WriteConfig(config Config) error

func WriteDnote added in v0.1.0

func WriteDnote(dnote Dnote) error

WriteDnote persists the state of Dnote into the dnote file

Types

type Book added in v0.1.0

type Book []Note

type Config added in v0.1.0

type Config struct {
	Book   string
	APIKey string
}

func ReadConfig added in v0.1.0

func ReadConfig() (Config, error)

type Dnote added in v0.1.0

type Dnote map[string]Book

func GetDnote added in v0.1.0

func GetDnote() (Dnote, error)

GetDnote reads and parses the dnote

type Note added in v0.1.0

type Note struct {
	UID     string
	Content string
	AddedOn int64
}

type YAMLDnote added in v0.1.0

type YAMLDnote map[string][]string

Deprecated. See upgrade/migrate.go

func GetNote added in v0.1.0

func GetNote() (YAMLDnote, error)

Deprecated. See upgrade/upgrade.go

Jump to

Keyboard shortcuts

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