shell

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Aliases       map[string]string
	DefaultPrompt string
)

Functions

func Critical added in v0.2.0

func Critical(err string)

func Warning added in v0.2.0

func Warning(warn string)

Types

type CommandFunction

type CommandFunction func([]string)

Type for built-in commands.

type Shell

type Shell struct {
	HistoryPath     string
	RcPath          string
	PathFiles       []string
	BuiltinCommands map[string]CommandFunction
	WdFiles         []string
	ExitCode        int
}

func New

func New() *Shell

Creates a new shell and returns a pointer.

func (*Shell) AddHistory added in v0.2.0

func (s *Shell) AddHistory(cmd string)

func (*Shell) Alias added in v0.2.0

func (s *Shell) Alias(args []string)

func (*Shell) Cd added in v0.2.0

func (s *Shell) Cd(args []string)

func (*Shell) EnsurePaths

func (s *Shell) EnsurePaths()

Creates if the history and .midorirc file does not exist.

func (*Shell) Exit added in v0.2.0

func (s *Shell) Exit(args []string)

func (*Shell) Export added in v0.2.0

func (s *Shell) Export(args []string)

func (*Shell) Getwd added in v0.2.0

func (s *Shell) Getwd()

Retrieves the directory where the shell is currently running. It then takes the files inside and puts them in s.WdFiles.

func (*Shell) Help added in v0.2.0

func (s *Shell) Help(args []string)

func (*Shell) InitBuiltins

func (s *Shell) InitBuiltins()

func (*Shell) InitPath

func (s *Shell) InitPath()

Save files to RAM to prevent Shell from reading the whole PATH variable on EVERY CHARACTER RECEIVED.

func (*Shell) RegisterCommand

func (s *Shell) RegisterCommand(key string, value func([]string)) *Shell

func (*Shell) StartRepl

func (s *Shell) StartRepl()

Starts read - evaluate - print - loop After this function is called, the control of the entire runtime is in this function.

Jump to

Keyboard shortcuts

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