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) MetaExtenders() []meta.Extender
- func (s *Shell) MetaFilters() []meta.Filter
- 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) SetActionAuthorizer(fn func(cmds.Action) bool)
- 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) SetMetaExtenders(e []meta.Extender)
- func (s *Shell) SetMetaFilters(f []meta.Filter)
- func (s *Shell) SetPublishTargets(t []cmds.PublishTarget)
- func (s *Shell) SetSkillsManagementEnabled(enabled bool)
- func (s *Shell) SetSkillsRemoteConfig(timeout time.Duration, maxBytes int64)
- func (s *Shell) SetValidators(validators []validation.Validator)
- func (s *Shell) SkillsManagementEnabled() bool
- func (s *Shell) SkillsRemoteMaxBytes() int64
- func (s *Shell) SkillsRemoteTimeout() time.Duration
- func (s *Shell) Validators() []validation.Validator
- 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) MetaExtenders ¶ added in v0.3.0
MetaExtenders reports the per-session `lore meta` extenders. Implements CmdContext.
func (*Shell) MetaFilters ¶ added in v0.3.0
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) SetActionAuthorizer ¶ added in v0.3.0
SetActionAuthorizer installs a per-invocation narrowing check.
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) SetMetaExtenders ¶ added in v0.3.0
SetMetaExtenders installs the plugin-contributed extenders applied by `lore meta`.
func (*Shell) SetMetaFilters ¶ added in v0.3.0
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 (*Shell) SetSkillsRemoteConfig ¶ added in v0.4.0
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 (*Shell) SkillsRemoteMaxBytes ¶ added in v0.4.0
func (*Shell) SkillsRemoteTimeout ¶ added in v0.4.0
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.