Package shell is the entry point for the terminal interface of Elvish.



This section is empty.


View Source
var Program prog.Program = program{}

Program is the shell subprogram.


func CleanupRuntime

func CleanupRuntime(stderr io.Writer, ev *eval.Evaler)

CleanupRuntime cleans up the runtime.

func InitRuntime

func InitRuntime(stderr io.Writer, p Paths, spawn bool) *eval.Evaler

InitRuntime initializes the runtime. The caller should call CleanupRuntime when the Evaler is no longer needed.

func Interact

func Interact(fds [3]*os.File, cfg *InteractConfig)

Interact runs an interactive shell session.

func Script

func Script(fds [3]*os.File, args []string, cfg *ScriptConfig) int

Script executes a shell script.


type InteractConfig

type InteractConfig struct {
	SpawnDaemon bool
	Paths       Paths

InteractConfig keeps configuration for the interactive mode.

type Paths

type Paths struct {
	RunDir          string
	Sock            string
	DaemonLogPrefix string

	DataDir string
	Db      string
	Rc      string
	LibDir  string

	Bin string

Paths keeps all paths required for the Elvish runtime.

func MakePaths

func MakePaths(stderr io.Writer, overrides Paths) Paths

MakePaths makes a populated Paths, using the given overrides.

type ScriptConfig

type ScriptConfig struct {
	SpawnDaemon bool
	Paths       Paths

	Cmd         bool
	CompileOnly bool
	JSON        bool

ScriptConfig keeps configuration for the script mode.