shell

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitArgs

func SplitArgs(line string) []string

SplitArgs splits a command line into args, respecting single and double quotes.

Types

type Shell

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

Shell is a restricted bash-like shell that operates over any vfs.FileSystem.

func NewShell

func NewShell(fs vfs.FileSystem) *Shell

NewShell creates a new Shell backed by the given vfs.FileSystem.

func (*Shell) ActionAllowed

func (s *Shell) ActionAllowed(a cmds.Action) bool

ActionAllowed reports whether the session may perform the capability class. An unrestricted shell (allowedActions == nil) permits everything.

func (*Shell) AllEnv

func (s *Shell) AllEnv() map[string]string

func (*Shell) Cwd

func (s *Shell) Cwd() string

func (*Shell) DeleteEnv

func (s *Shell) DeleteEnv(key string)

func (*Shell) Docsets

func (s *Shell) Docsets() []cmds.DocsetInfo

Docsets reports the per-session docset views. Implements CmdContext.

func (*Shell) Exec

func (s *Shell) Exec(cmdLine string, w io.Writer, errW io.Writer, stdin io.Reader) int

Exec parses and executes a single command line.

func (*Shell) ExecPipeline

func (s *Shell) ExecPipeline(line string, w io.Writer, errW io.Writer, stdin io.Reader) int

ExecPipeline parses a shell line and executes the resulting AST. stdin is optional — pass nil if no external stdin is available.

func (*Shell) FS

func (s *Shell) FS() vfs.FileSystem

func (*Shell) GetEnv

func (s *Shell) GetEnv(key string) string

func (*Shell) MetaExtenders added in v0.3.0

func (s *Shell) MetaExtenders() []meta.Extender

MetaExtenders reports the per-session `lore meta` extenders. Implements CmdContext.

func (*Shell) MetaFilters added in v0.3.0

func (s *Shell) MetaFilters() []meta.Filter

func (*Shell) PublishTargets

func (s *Shell) PublishTargets() []cmds.PublishTarget

PublishTargets reports the per-session publish inboxes. Implements CmdContext.

func (*Shell) Resolve

func (s *Shell) Resolve(p string) string

func (*Shell) RunInteractive

func (s *Shell) RunInteractive(rw io.ReadWriter, errW io.Writer, motd string, prompt string)

RunInteractive runs an interactive shell session. rw is used for both reading input and writing output. When running over an SSH session with an allocated PTY, the session's ptyWriter already converts \n to \r\n, so no additional CRLFWriter wrapping is needed.

func (*Shell) SetActionAuthorizer added in v0.3.0

func (s *Shell) SetActionAuthorizer(fn func(cmds.Action) bool)

SetActionAuthorizer installs a per-invocation narrowing check.

func (*Shell) SetAllowedActions

func (s *Shell) SetAllowedActions(actions []cmds.Action)

SetAllowedActions restricts the shell to the given capability classes (Part B). Passing nil (or not calling this) leaves the shell unrestricted. ActionRead is always implied so that read-only commands and introspection (help, ls, …) keep working.

func (*Shell) SetConflictPolicyFn

func (s *Shell) SetConflictPolicyFn(fn func(resolvedPath string) vfs.WriteConflictPolicy)

SetConflictPolicyFn installs a resolver that maps a resolved path to its write-conflict policy. Passing nil restores the default (vfs.PolicyHash).

func (*Shell) SetCwd

func (s *Shell) SetCwd(dir string)

func (*Shell) SetDocsets

func (s *Shell) SetDocsets(d []cmds.DocsetInfo)

SetDocsets installs the per-session docset views surfaced by `lore docsets`.

func (*Shell) SetEnv

func (s *Shell) SetEnv(key, value string)

func (*Shell) SetMetaExtenders added in v0.3.0

func (s *Shell) SetMetaExtenders(e []meta.Extender)

SetMetaExtenders installs the plugin-contributed extenders applied by `lore meta`.

func (*Shell) SetMetaFilters added in v0.3.0

func (s *Shell) SetMetaFilters(f []meta.Filter)

func (*Shell) SetPublishTargets

func (s *Shell) SetPublishTargets(t []cmds.PublishTarget)

SetPublishTargets installs the per-session publish inboxes used by `publish`.

func (*Shell) SetSkillsManagementEnabled added in v0.4.0

func (s *Shell) SetSkillsManagementEnabled(enabled bool)

func (*Shell) SetSkillsRemoteConfig added in v0.4.0

func (s *Shell) SetSkillsRemoteConfig(timeout time.Duration, maxBytes int64)

func (*Shell) SetValidators added in v0.3.0

func (s *Shell) SetValidators(validators []validation.Validator)

SetValidators installs plugin-contributed checks for `lore validate`.

func (*Shell) SkillsManagementEnabled added in v0.4.0

func (s *Shell) SkillsManagementEnabled() bool

func (*Shell) SkillsRemoteMaxBytes added in v0.4.0

func (s *Shell) SkillsRemoteMaxBytes() int64

func (*Shell) SkillsRemoteTimeout added in v0.4.0

func (s *Shell) SkillsRemoteTimeout() time.Duration

func (*Shell) Validators added in v0.3.0

func (s *Shell) Validators() []validation.Validator

Validators reports this shell's plugin-contributed validation checks.

func (*Shell) WriteConflictPolicy

func (s *Shell) WriteConflictPolicy(resolvedPath string) vfs.WriteConflictPolicy

WriteConflictPolicy reports the policy for overwrites to resolvedPath. With no resolver installed it returns the default compare-and-swap policy.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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