Documentation
¶
Index ¶
- func SplitArgs(line string) []string
- type Shell
- func (s *Shell) ActionAllowed(a cmds.Action) bool
- func (s *Shell) AllEnv() map[string]string
- func (s *Shell) Cwd() string
- func (s *Shell) DeleteEnv(key string)
- func (s *Shell) Docsets() []cmds.DocsetInfo
- func (s *Shell) Exec(cmdLine string, w io.Writer, errW io.Writer, stdin io.Reader) int
- func (s *Shell) ExecPipeline(line string, w io.Writer, errW io.Writer, stdin io.Reader) int
- func (s *Shell) FS() vfs.FileSystem
- func (s *Shell) GetEnv(key string) string
- func (s *Shell) PublishTargets() []cmds.PublishTarget
- func (s *Shell) Resolve(p string) string
- func (s *Shell) RunInteractive(rw io.ReadWriter, errW io.Writer, motd string, prompt string)
- func (s *Shell) SetAllowedActions(actions []cmds.Action)
- func (s *Shell) SetConflictPolicyFn(fn func(resolvedPath string) vfs.WriteConflictPolicy)
- func (s *Shell) SetCwd(dir string)
- func (s *Shell) SetDocsets(d []cmds.DocsetInfo)
- func (s *Shell) SetEnv(key, value string)
- func (s *Shell) SetPublishTargets(t []cmds.PublishTarget)
- func (s *Shell) WriteConflictPolicy(resolvedPath string) vfs.WriteConflictPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
ActionAllowed reports whether the session may perform the capability class. An unrestricted shell (allowedActions == nil) permits everything.
func (*Shell) Docsets ¶
func (s *Shell) Docsets() []cmds.DocsetInfo
Docsets reports the per-session docset views. Implements CmdContext.
func (*Shell) ExecPipeline ¶
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) PublishTargets ¶
func (s *Shell) PublishTargets() []cmds.PublishTarget
PublishTargets reports the per-session publish inboxes. Implements CmdContext.
func (*Shell) RunInteractive ¶
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) SetAllowedActions ¶
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) SetDocsets ¶
func (s *Shell) SetDocsets(d []cmds.DocsetInfo)
SetDocsets installs the per-session docset views surfaced by `lore docsets`.
func (*Shell) SetPublishTargets ¶
func (s *Shell) SetPublishTargets(t []cmds.PublishTarget)
SetPublishTargets installs the per-session publish inboxes used by `publish`.
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.