shell

package
v0.0.0-...-c996816 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package shell is built above the x/term library and provides friendlier bindings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

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

Query represents a single command line sent by the user.

func (*Query) Argv

func (q *Query) Argv() []string

Argv returns an array of whitespace separated arguments from the user's command.

func (*Query) Exit

func (q *Query) Exit()

Exit stops the interactive shell after the handler returns.

func (*Query) Line

func (q *Query) Line() string

Line returns the line sent by the user

func (Query) Print

func (q Query) Print(a ...any) (int, error)

Print writes the string to the terminal

func (*Query) Printf

func (q *Query) Printf(format string, a ...any) (int, error)

func (*Query) Println

func (q *Query) Println(a ...any) (int, error)

Println writes the string to the terminal then adds a newline.

type Shell

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

func New

func New(prompt string, handler func(*Query) error) *Shell

func (*Shell) Run

func (s *Shell) Run() error

Jump to

Keyboard shortcuts

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