output

package
v0.0.0-...-5db7531 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stdout

type Stdout struct {
	// contains filtered or unexported fields
}

Stdout is a simple slk.Output implementation that writes everything to stdout.

func NewStdout

func NewStdout(username, timeFormat string) *Stdout

NewStdout returns an Stdout

func (*Stdout) Debug

func (s *Stdout) Debug(msg ...string)

func (*Stdout) File

func (s *Stdout) File(channel, from, title, url string)

func (*Stdout) Info

func (s *Stdout) Info(msg string)

func (*Stdout) List

func (s *Stdout) List(list slk.ListItems, reverse bool)

func (*Stdout) Msg

func (s *Stdout) Msg(channel, from, msg string, ts time.Time, section bool)

func (*Stdout) Notice

func (s *Stdout) Notice(msg string)

func (*Stdout) Notify

func (s *Stdout) Notify(channel, from, text string, force bool)

func (*Stdout) SetUsername

func (s *Stdout) SetUsername(username string)

SetUsername sets the current user's name so the formatter can make it stand out.

func (*Stdout) Typing

func (s *Stdout) Typing(channel, user string, timeout time.Duration)

func (*Stdout) Warn

func (s *Stdout) Warn(msg string)

type Term

type Term struct {
	// contains filtered or unexported fields
}

Term is a gocui / termbox slk.Output implementation that allows for user input which is communicated over the input channel as returned by NewTerm.

func NewTerm

func NewTerm(
	appName,
	appIcon,
	username string,
	timeFormat string,
	notificationLimit time.Duration,
	notificationTimeout time.Duration,
) (t *Term, input chan string)

NewTerm returns a Term and an input channel which will receive the current input field contents when it is 'submitted'.

func (*Term) BindKey

func (t *Term) BindKey(key gocui.Key, handler func() error) error

BindKey allows binding a gocui.Key-press to the given handler.

func (*Term) Clear

func (t *Term) Clear()

Clear the chat view

func (*Term) Debug

func (t *Term) Debug(msg ...string)

func (*Term) File

func (t *Term) File(channel, from, title, url string)

func (*Term) Info

func (t *Term) Info(msg string)

func (*Term) Init

func (t *Term) Init() (err error)

Init sets up the gocui / termbox environment.

func (*Term) Input

func (t *Term) Input() string

Input returns the contents of the input field.

func (*Term) List

func (t *Term) List(list slk.ListItems, reverse bool)

func (*Term) Meta

func (t *Term) Meta(str string)

Meta like List writes its output to the info view.

func (*Term) Msg

func (t *Term) Msg(channel, from, msg string, ts time.Time, section bool)

func (*Term) Notice

func (t *Term) Notice(msg string)

func (*Term) Notify

func (t *Term) Notify(channel, from, text string, force bool)

func (*Term) Quit

func (t *Term) Quit()

Quit should stop the event loop and return the terminal to a usable state. TODO block until we've actually quit.

func (*Term) Run

func (t *Term) Run() error

Run starts the gocui and Term event loop.

func (*Term) SetInput

func (t *Term) SetInput(str string, posX int, posY int, submit bool)

SetInput overwrites the current input field and sets the cursor to posX x posY.

If posY == -1 the cursor will be set to the last line.

If posX == -1 the cursor will be set the last column of the current line.

If submit == true the contents will be send to the input channel.

func (*Term) SetUsername

func (t *Term) SetUsername(username string)

SetUsername sets the current user's name so the formatter can make it stand out. Also disables notifications if messages are received from this user.

func (*Term) Typing

func (t *Term) Typing(channel, user string, timeout time.Duration)

func (*Term) Warn

func (t *Term) Warn(msg string)

Jump to

Keyboard shortcuts

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