Documentation ¶
Overview ¶
Package termfs provides a lightweight implementation of terminal device filesystem.
Index ¶
- type CharMap
- type FS
- func (fsys *FS) CharMap() CharMap
- func (fsys *FS) Echo() bool
- func (fsys *FS) LineMode() (enabled bool, maxLen int)
- func (fsys *FS) Name() string
- func (fsys *FS) OpenWithFinalizer(name string, flag int, perm fs.FileMode, closed func()) (fs.File, error)
- func (fsys *FS) SetCharMap(cmap CharMap)
- func (fsys *FS) SetEcho(on bool)
- func (fsys *FS) SetLineMode(enable bool, maxLen int)
- func (fsys *FS) Type() string
- func (fsys *FS) Usage() (int, int, int64, int64)
- type LightFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
An FS provides a file system that represents a terminal device. As the embeded systems rarely require more than one terminal device (console) the FS is very simple and provides only one device file "." which can be opened, written and read concurenly by multiple goroutines.
func New ¶
New returns a new terminal file system named name. The r and w correspond to the terminal input and output device.
func (*FS) OpenWithFinalizer ¶
func (fsys *FS) OpenWithFinalizer(name string, flag int, perm fs.FileMode, closed func()) (fs.File, error)
OpenWithFinalizer implements the rtos.FS OpenWithFinalizer method. The name must be ".", the flag can be O_RDWR, O_RDONLY, O_WRONLY, the perm is ignored.
func (*FS) SetCharMap ¶ added in v0.0.2
func (*FS) SetEcho ¶ added in v0.0.2
SetEcho enables/disables echoing of input data. Data are echoed by fs.File Read method. The echo is a confirmation that the reading goroutine is ready to consume data.
func (*FS) SetLineMode ¶ added in v0.0.2
SetLineMode allows to enable/disable the line mode and change the size of the internal line buffer. The default line buffer has zero size. Use maxLen > 0 to allocate a new one, maxLen == 0 to free it and maxLen < 0 to leave the line buffer unchanged.
In the line mode the terminal input is buffered until new-line character received. Small subset of ANSI terminal codes is supported to enable editing the line before passing it to the reading goroutine. There is also simple one line history implemented (use up, down arrows).
type LightFS ¶ added in v0.0.3
type LightFS struct {
// contains filtered or unexported fields
}
An LightFS provides a file system that represents a terminal device. It is a thin wrapper over provided io.Reader and io.Writer that allows use them concurently by multiple goroutines. Unlike FS it does not support CR/LF conversions, echo, line editing. If you need such futures use FS or configure your terminal emulator to handle them locally.
func NewLight ¶ added in v0.0.3
NewLight returns a new terminal file system named name. The r and w correspond to the terminal input and output device.
func (*LightFS) OpenWithFinalizer ¶ added in v0.0.3
func (fsys *LightFS) OpenWithFinalizer(name string, flag int, perm fs.FileMode, closed func()) (fs.File, error)
OpenWithFinalizer implements the rtos.FS OpenWithFinalizer method. The name must be ".". The flag and perm are ignored.