model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

Source: https://raw.githubusercontent.com/charmbracelet/glow/d0737b41af48960a341e24327d9d5acb5b7d92aa/ui/doctypes.go

Source: https://raw.githubusercontent.com/charmbracelet/glow/d0737b41af48960a341e24327d9d5acb5b7d92aa/ui/markdown.go

Source: https://github.com/maaslalani/slides/blob/main/internal/model/model.go

Pager is lifted from https://raw.githubusercontent.com/charmbracelet/glow/d0737b41af48960a341e24327d9d5acb5b7d92aa/ui/pager.go Thank you for such an awesome design!

Source: https://raw.githubusercontent.com/charmbracelet/glow/d0737b41af48960a341e24327d9d5acb5b7d92aa/ui/stash.go

Source: https://raw.githubusercontent.com/charmbracelet/glow/master/ui/stashhelp.go

Source: https://raw.githubusercontent.com/charmbracelet/glow/master/ui/stashitem.go

Source: https://raw.githubusercontent.com/charmbracelet/glow/d0737b41af48960a341e24327d9d5acb5b7d92aa/ui/styles.go

Source: https://raw.githubusercontent.com/charmbracelet/glow/d0737b41af48960a341e24327d9d5acb5b7d92aa/ui/ui.go

Index

Constants

This section is empty.

Variables

View Source
var (
	// EntryTemplate is the default value for a new entry's content
	EntryTemplate = `- [ ] ...`

	// DefaultConfig is the default configuration that is used, along with ~/.jot.yaml
	DefaultConfig = v1.Config{
		Directory:      "~/.jot.d",
		WeekendTags:    []string{"weekend"},
		WorkdayTags:    []string{"work", "$employer"},
		HolidayTags:    []string{"holiday"},
		StartWorkHours: 9 * time.Hour,
		EndWorkHours:   18*time.Hour + 30*time.Minute,
	}

	// CreateDirectoryIfMissing creates config.Directory if not already existing
	CreateDirectoryIfMissing = true
)

Functions

func AsMarkdown

func AsMarkdown(path string, e v1.Entry) markdown

func EntryTaskStatus

func EntryTaskStatus(e *v1.Entry, style TaskCompletionStyle) string

Types

type DocType

type DocType int

DocType represents a type of markdown document.

const (
	NoDocType DocType = iota
	LocalDoc
	StashedDoc
	ConvertedDoc
	NewsDoc
)

Available document types.

func (DocType) String

func (d DocType) String() string

type DocTypeSet

type DocTypeSet map[DocType]struct{}

DocTypeSet is a set (in the mathematic sense) of document types.

func NewDocTypeSet

func NewDocTypeSet(t ...DocType) DocTypeSet

NewDocTypeSet returns a set of document types.

func (*DocTypeSet) Add

func (d *DocTypeSet) Add(t ...DocType) int

Add adds a document type of the set.

func (DocTypeSet) AsSlice

func (d DocTypeSet) AsSlice() (agg []DocType)

AsSlice returns the set as a slice of document types.

func (DocTypeSet) Contains

func (d DocTypeSet) Contains(m ...DocType) bool

Contains returns whether or not the set contains the given DocTypes.

func (DocTypeSet) Difference

func (d DocTypeSet) Difference(t ...DocType) DocTypeSet

Difference return a DocumentType set that does not contain the given types.

func (DocTypeSet) Equals

func (d DocTypeSet) Equals(other DocTypeSet) bool

Equals returns whether or not the two sets are equal.

type Mode

type Mode string
var (
	ViewMode Mode = "view"
	HelpMode Mode = "help"
	EditMode Mode = "edit"
	ListMode Mode = "list"

	UseHighPerformanceRendering = false
)

type Model

type Model struct {
	db.DB
	UseAltScreen bool

	Author   string
	Timeline []time.Time
	Date     time.Time
	Config   v1.Config
	Mode     Mode
	// contains filtered or unexported fields
}

func NewFromConfigFile

func NewFromConfigFile(path string, user string, useAltScreen bool) (*Model, error)

func (*Model) CurrentEntry

func (m *Model) CurrentEntry() (*v1.Entry, error)

func (*Model) CurrentEntryPath

func (m *Model) CurrentEntryPath() string

func (*Model) DefaultTagsForTime

func (m *Model) DefaultTagsForTime(t time.Time) []string

func (*Model) EditMarkdown

func (m *Model) EditMarkdown(md *markdown) tea.Cmd

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) LogUserError

func (m *Model) LogUserError(err error)

LogUserNotice registers an informational message with the app for display via UI, logs, whatever

func (*Model) LogUserNotice

func (m *Model) LogUserNotice(msg string)

func (*Model) TitleFromTime

func (m *Model) TitleFromTime(t time.Time) string

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages emitted by the model

func (Model) View

func (m Model) View() string

type TaskCompletionStyle

type TaskCompletionStyle string
var (
	TaskStylePercent  TaskCompletionStyle = "percent"
	TaskStyleDiscrete TaskCompletionStyle = "discrete"
)

type TaskListStatus

type TaskListStatus struct {
	Checked int
	Total   int
}

func TaskList

func TaskList(content string) TaskListStatus

func (*TaskListStatus) Percent

func (tls *TaskListStatus) Percent() float64

func (*TaskListStatus) PercentString

func (tls *TaskListStatus) PercentString() string

func (*TaskListStatus) String

func (tls *TaskListStatus) String() string

Jump to

Keyboard shortcuts

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