app

package
v0.0.0-...-bb33583 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleCommandInput

func HandleCommandInput(screen tcell.Screen) (string, rune)

func HandleViewerInput

func HandleViewerInput(screen tcell.Screen, threads model.Threads, t, p int) (string, int, int)
func NavBottom(threads model.Threads) (int, int)
func NavDownPost(threads model.Threads, t, p int) (int, int)
func NavDownThread(threads model.Threads, t int) (int, int)
func NavTop() (int, int)
func NavUpPost(threads model.Threads, t, p int) (int, int)
func NavUpThread(t int) (int, int)

func PauseUntilInput

func PauseUntilInput(screen tcell.Screen)

Types

type App

type App struct {
	Site      model.Site
	SiteInput model.SiteInput
	Style     Style
	// contains filtered or unexported fields
}

func NewApp

func NewApp() App

func (*App) CommandMode

func (a *App) CommandMode()

func (*App) ContinueStub

func (a *App) ContinueStub()

func (*App) Error

func (a *App) Error(format string, v ...any)

Error will show an error message and continue

func (*App) ExecCommand

func (a *App) ExecCommand(cmd string)

func (*App) Fatal

func (a *App) Fatal(format string, v ...any)

Fatal will show an error message and quit the program

func (*App) Info

func (a *App) Info(format string, v ...any)

Info will show an error message and continue

func (*App) InitScreen

func (a *App) InitScreen() error

func (*App) Refresh

func (a *App) Refresh()

func (*App) RunApp

func (a *App) RunApp() error

func (*App) SearchNext

func (a *App) SearchNext()

func (*App) SearchPrev

func (a *App) SearchPrev()

func (*App) SearchStart

func (a *App) SearchStart(term string)

func (*App) SetCommandMode

func (a *App) SetCommandMode(cmd string)

func (*App) SetViewerMode

func (a *App) SetViewerMode()

func (*App) Terminate

func (a *App) Terminate(format string, v ...any)

Terminate will show an info message and quit the program

func (*App) ViewerMode

func (a *App) ViewerMode()

type InfoLevel

type InfoLevel string
const (
	InfoLevelInfo      InfoLevel = "info"
	InfoLevelTerminate InfoLevel = "terminate"
	InfoLevelError     InfoLevel = "error"
	InfoLevelFatal     InfoLevel = "fatal"
)

type Mode

type Mode string
const (
	ModeCommand Mode = "command"
	ModeViewer  Mode = "viewer"
)
type Search struct {
	Term    string
	Results model.Posts
	Index   int
}

type Style

type Style struct {
	MessageLength int
	FullIndent    int
	SemiIndent    int

	// Post author line
	AuthorStart   tcell.Style
	AuthorName    tcell.Style
	UpVotesIcon   tcell.Style
	UpVotesNum    tcell.Style
	DownVotesIcon tcell.Style
	DownVotesNum  tcell.Style
	Time          tcell.Style
	Separator     tcell.Style

	// Characters
	AuthorStartChar rune
	UpVotesChar     rune
	DownVotesChar   rune
	SeparatorChar   rune

	// Post message
	ActiveMessage     tcell.Style
	RegularMessage    tcell.Style
	ActiveStubMessage tcell.Style
	StubMessage       tcell.Style

	// Characters
	ActiveMessageChar rune
	StubStartChar     rune

	// Command/Search
	Command tcell.Style

	// Info message
	LoadingMessage tcell.Style
	InfoMessage    tcell.Style
	ErrorMessage   tcell.Style
}

func DefaultStyle

func DefaultStyle() Style

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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