Documentation
¶
Overview ¶
Package localterm_svc 管理本地 shell(PTY)终端会话。
Index ¶
- type ConnectConfig
- type Manager
- func (m *Manager) CloseAll()
- func (m *Manager) Connect(cfg ConnectConfig) (string, error)
- func (m *Manager) Disconnect(sessionID string)
- func (m *Manager) GetSession(sessionID string) (*Session, bool)
- func (m *Manager) SetCallbacks(sessionID string, onData func([]byte), onClosed func(string))
- func (m *Manager) SplitFrom(existingSessionID string, cols, rows int) (string, error)
- type Session
- type ShellInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectConfig ¶
ConnectConfig 本地终端连接配置。
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 管理所有本地终端会话。
func (*Manager) Connect ¶
func (m *Manager) Connect(cfg ConnectConfig) (string, error)
Connect 启动一个本地 shell,返回 sessionID。调用方随后用 SetCallbacks 挂回调。
func (*Manager) GetSession ¶
GetSession 获取活跃会话。
func (*Manager) SetCallbacks ¶
SetCallbacks 挂数据/关闭回调,回调就绪后才启动 reader,避免首屏输出丢失。
type ShellInfo ¶
type ShellInfo struct {
Name string `json:"name"` // 展示名,如 "zsh" / "WSL: Ubuntu" / "Git Bash"
Path string `json:"path"` // 可执行文件路径
Args []string `json:"args,omitempty"` // 启动参数,如 ["-d","Ubuntu"]
}
ShellInfo 描述一个可供用户选择的本地 shell 预设。 Args 让 "shell+固定参数" 的预设(如 WSL 发行版、Git Bash 登录)可一键选中。
func DetectShells ¶
func DetectShells() []ShellInfo
DetectShells 探测本机可用 shell:$SHELL(默认优先)+ /etc/shells(系统权威清单)。
Click to show internal directories.
Click to hide internal directories.