shell

package
v0.0.0-...-445aba9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2014 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName         = "whatunga"
	AppVersionMajor = 0
	AppVersionMinor = 5
	AppVersionMicro = 0

)

Variables

View Source
var AppVersionRev string

revision part of the program version. This will be set automatically at build time by using: go build -ldflags "-X shell.AppVersionRev `date -u +%s`"

View Source
var CatchSigint = true

The readline package adds a signal handler for SIGINT at init. If CatchSigint is true, upon receiving the signal (typically from the user pressing Ctrl+C) it will restore the terminal attributes and call os.Exit(1).

Applications that install their own SIGINT handler should set this variable to false, and call Cleanup() manually if the handler causes the application to terminate while a String() call is running.

View Source
var Completer = func(query, ctx string) []string {
	return nil
}

This function provides entries for the tab completer.

View Source
var CompletionAppendChar = 0

If CompletionAppendChar is non-zero, readline will append the corresponding character to the prompt after each completion. A typical value would be a space.

View Source
var Continue = ".."

The continue prompt used by Reader(). The prompt can contain ANSI escape sequences, they will be escaped as necessary.

View Source
var Prompt = "> "

The prompt used by Reader(). The prompt can contain ANSI escape sequences, they will be escaped as necessary.

Functions

func AddHistory

func AddHistory(s string)

Add an item to the history.

func Cleanup

func Cleanup()

Cleanup() frees internal memory and restores terminal attributes. This function should be called when program execution stops before the return of a String() call, so as not to leave the terminal in a corrupted state.

If the CatchSigint variable is set to true (default), Cleanup() is called automatically on reception of a SIGINT signal.

func ClearHistory

func ClearHistory()

Deletes all the items in the history.

func FilenameCompleter

func FilenameCompleter(query, ctx string) []string

This function can be assigned to the Completer variable to use readline's default filename completion, or it can be called by a custom completer function to get a list of files and filter it.

func GetHistory

func GetHistory(i int) string

Retrieve a line from the history.

func HistorySize

func HistorySize() int

Returns the number of items in the history.

func LoadHistory

func LoadHistory(path string) error

Load the history from a file.

func Readline

func Readline(prompt string) (string, error)

Read a line with the given prompt. The prompt can contain ANSI escape sequences, they will be escaped as necessary.

func SaveHistory

func SaveHistory(path string) error

Save the history to a file.

func SetWordBreaks

func SetWordBreaks(cs string)

func Start

func Start(info string, project *model.Project)

Types

This section is empty.

Jump to

Keyboard shortcuts

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