term

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package term contains a terminal implementation which can control Rufs trees.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TreeTerm

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

TreeTerm models a command processor for Rufs trees.

func NewTreeTerm

func NewTreeTerm(t *rufs.Tree, out io.Writer) *TreeTerm

NewTreeTerm returns a new command processor for Rufs trees.

func (*TreeTerm) AddCmd

func (tt *TreeTerm) AddCmd(cmd, helpusage, help string,
	cmdFunc func(*TreeTerm, ...string) (string, error))

AddCmd adds a new command to the terminal

func (*TreeTerm) ClearStatus

func (tt *TreeTerm) ClearStatus()

ClearStatus removes the last status line and returns the cursor to the initial position.

func (*TreeTerm) Cmds

func (tt *TreeTerm) Cmds() []string

Cmds returns a list of available terminal commands.

func (*TreeTerm) CurrentDir

func (tt *TreeTerm) CurrentDir() string

CurrentDir returns the current directory of this TreeTerm.

func (*TreeTerm) Run

func (tt *TreeTerm) Run(line string) (string, error)

Run executes a given command line. And return its output as a string. File output and other streams to the console are written to the output writer.

func (*TreeTerm) WriteStatus

func (tt *TreeTerm) WriteStatus(line string)

WriteStatus writes a status line to the output writer.

Jump to

Keyboard shortcuts

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