shell

package
v1.11.26 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 8 Imported by: 1

README

shell-prompt

To start an embedded shell-like prompt, type and run:

$ go run ./examples/shell-mode/ sh

See also: shell-mode app.

It looks like:

image

and

image

Type exit, quit, or shortcut CTRL-D to terminate the prompt session.

shell-prompt is powered by https://github.com/c-bata/go-prompt.

Backstage

Simply add shell.WithShellModule() to your cmdr entry

func Entry() {
	if err := cmdr.Exec(buildRootCmd(),
		shell.WithShellModule(),
	); err != nil {
		logrus.Fatalf("error: %+v", err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LivePrefixState struct {
	LivePrefix string
	IsEnable   bool
}

LivePrefixState is a struct for auto-completion

Functions

func ExecuteAndGetResult

func ExecuteAndGetResult(s string) string

ExecuteAndGetResult executes an command line string `s` and capture its outputs.

func WithShellModule

func WithShellModule() cmdr.ExecOption

WithShellModule adds `shell` sub-command to cmdr system

Types

This section is empty.

Jump to

Keyboard shortcuts

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