nsterm

package
v0.5.1-beta-hotfix1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Backspace string = string([]byte{127})
View Source
var CarriageReturn string = "\r"
View Source
var CtrlC string = string([]byte{3})
View Source
var CursorDown string = "\033[B"
View Source
var CursorEnd string = "\033[F"
View Source
var CursorHome string = "\033[H"
View Source
var CursorLeft string = "\033[D"
View Source
var CursorRight string = "\033[C"
View Source
var CursorUp string = "\033[A"
View Source
var DefaultEscSet map[string]string = map[string]string{
	CursorUp:    "",
	CursorDown:  "",
	CursorLeft:  "",
	CursorRight: "",
	Backspace:   "",
	CtrlC:       "",
	CursorHome:  "",
	CursorEnd:   "",
	Delete:      "",
}
View Source
var Delete string = "\033[3~"
View Source
var ErrClosedPipe = io.ErrClosedPipe
View Source
var HandleScapeMode = false

I+D+I

View Source
var LineFeed string = "\n"

Functions

func LFtoCRLF

func LFtoCRLF(data []byte) []byte

commonly from app to term (from slave to master)

func NewFD

func NewPipe

func NewPipe() (io.ReadCloser, io.WriteCloser)

func NopWriter

func NopWriter(w io.Writer) io.WriteCloser

Types

type DefaultLdisc

type DefaultLdisc struct {
	ERR chan error
	// LineBuff     []byte
	RuneBuff     []rune
	CursorOffset int
	ESC          chan string
	ECO          bool
	//
	ESCSet map[string]string
	// contains filtered or unexported fields
}

func NewDefaultLdisc

func NewDefaultLdisc() *DefaultLdisc

func (*DefaultLdisc) Close

func (d *DefaultLdisc) Close() error

func (*DefaultLdisc) GetESC

func (d *DefaultLdisc) GetESC() chan string

func (*DefaultLdisc) IOctl

func (d *DefaultLdisc) IOctl()

func (*DefaultLdisc) ReadRuneBuff

func (d *DefaultLdisc) ReadRuneBuff() []rune

func (*DefaultLdisc) ReceiveMustarBuff

func (d *DefaultLdisc) ReceiveMustarBuff(n int, mInFD *PortFD)

Called from vpty on mustar port write. Read -> process -> Write to sluva FD

func (*DefaultLdisc) ReceiveSluvaBuff

func (d *DefaultLdisc) ReceiveSluvaBuff(n int, sInFD *PortFD)

func (*DefaultLdisc) SetBuff

func (d *DefaultLdisc) SetBuff(s string)

func (*DefaultLdisc) SetMustarFD

func (d *DefaultLdisc) SetMustarFD(fd io.ReadWriteCloser)

func (*DefaultLdisc) SetSluvaFD

func (d *DefaultLdisc) SetSluvaFD(fd io.ReadWriteCloser)

type Ldisc

type Ldisc interface {
	SetMustarFD(io.ReadWriteCloser)
	SetSluvaFD(io.ReadWriteCloser)
	// Call it to disable this ldisc
	Close() error
	// interface to control ldisc, WIP
	IOctl()
	// To be called from vpty on
	// mustar/sluva writes
	ReceiveMustarBuff(int, *PortFD)
	ReceiveSluvaBuff(int, *PortFD)
	//
	ReadRuneBuff() []rune
	SetBuff(s string)
	GetESC() chan string
}

type MultiUserLdisc

type MultiUserLdisc struct {
	MustarWriteCount int
	MustarReadCount  int
	// contains filtered or unexported fields
}

func NewMultiUserLdisc

func NewMultiUserLdisc() *MultiUserLdisc

func (*MultiUserLdisc) Close

func (m *MultiUserLdisc) Close() error

func (*MultiUserLdisc) GetESC

func (m *MultiUserLdisc) GetESC() chan string

NOOP

func (*MultiUserLdisc) IOctl

func (m *MultiUserLdisc) IOctl()

func (*MultiUserLdisc) ReadRuneBuff

func (m *MultiUserLdisc) ReadRuneBuff() []rune

NOOP

func (*MultiUserLdisc) ReceiveMustarBuff

func (m *MultiUserLdisc) ReceiveMustarBuff(n int, mInFD *PortFD)

func (*MultiUserLdisc) ReceiveSluvaBuff

func (m *MultiUserLdisc) ReceiveSluvaBuff(n int, sInFD *PortFD)

func (*MultiUserLdisc) SetBuff

func (m *MultiUserLdisc) SetBuff(s string)

NOOP

func (*MultiUserLdisc) SetMustarFD

func (m *MultiUserLdisc) SetMustarFD(fd io.ReadWriteCloser)

func (*MultiUserLdisc) SetSluvaFD

func (m *MultiUserLdisc) SetSluvaFD(fd io.ReadWriteCloser)

type Port

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

Port a pair of pipes

func (*Port) InFD

func (p *Port) InFD() *PortFD

func (*Port) OutFD

func (p *Port) OutFD() *PortFD

type PortFD

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

PortFD the internal or external part of the two pipes of *Port

func (*PortFD) Close

func (fd *PortFD) Close() error

func (*PortFD) GetRawR

func (fd *PortFD) GetRawR() io.ReadCloser

func (*PortFD) GetRawW

func (fd *PortFD) GetRawW() io.WriteCloser

func (*PortFD) Read

func (fd *PortFD) Read(p []byte) (n int, err error)

func (*PortFD) Write

func (fd *PortFD) Write(p []byte) (n int, err error)

type Prompt

type Prompt struct {
	PS1 []byte
	// contains filtered or unexported fields
}

Prompt struct. A helper to write shell prompts asking for a input abstracting the origin of the app and the input source. This means that the source and/or the app can be local or remote. This should be used with VPTY2 that handles all the complex stuff. This pieze allows to have a PS prompt, line edit and history.

func NewPrompt

func NewPrompt(vpty *VPTY2, stdin io.ReadCloser, stdout io.WriteCloser) *Prompt

func (*Prompt) ReadLine

func (p *Prompt) ReadLine() (*string, error)

func (*Prompt) SetPS1

func (p *Prompt) SetPS1(ps1 string)

type RawLdisc

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

func NewRawLdisc

func NewRawLdisc() *RawLdisc

func (*RawLdisc) Close

func (r *RawLdisc) Close() error

func (*RawLdisc) GetESC

func (r *RawLdisc) GetESC() chan string

NOOP

func (*RawLdisc) IOctl

func (r *RawLdisc) IOctl()

func (*RawLdisc) ReadRuneBuff

func (r *RawLdisc) ReadRuneBuff() []rune

NOOP

func (*RawLdisc) ReceiveMustarBuff

func (r *RawLdisc) ReceiveMustarBuff(n int, mInFD *PortFD)

func (*RawLdisc) ReceiveSluvaBuff

func (r *RawLdisc) ReceiveSluvaBuff(n int, sInFD *PortFD)

func (*RawLdisc) SetBuff

func (r *RawLdisc) SetBuff(s string)

NOOP

func (*RawLdisc) SetMustarFD

func (r *RawLdisc) SetMustarFD(fd io.ReadWriteCloser)

func (*RawLdisc) SetSluvaFD

func (r *RawLdisc) SetSluvaFD(fd io.ReadWriteCloser)

type VPTY2

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

func NewVirtPTY

func NewVirtPTY() *VPTY2

func (*VPTY2) Close

func (v *VPTY2) Close() error

func (*VPTY2) CursorMustar

func (v *VPTY2) CursorMustar(p *Port) error

func (*VPTY2) CursorSluva

func (v *VPTY2) CursorSluva(p *Port) error

func (*VPTY2) DestroyPort

func (v *VPTY2) DestroyPort(p *Port) error

func (*VPTY2) GetLDisc

func (v *VPTY2) GetLDisc() (ldisc Ldisc)

func (*VPTY2) MustarFD

func (v *VPTY2) MustarFD() *PortFD

MustarFD file descriptor for term write here keyboard input (os.Stdin) read from here the term data (and write to os.Stdout)

func (*VPTY2) NewMustarPort

func (v *VPTY2) NewMustarPort() *Port

func (*VPTY2) NewSluvaPort

func (v *VPTY2) NewSluvaPort() *Port

NewSluvaPort create new sluva port, it will stored

func (*VPTY2) SetLDisc

func (v *VPTY2) SetLDisc(ldisc Ldisc)

func (*VPTY2) SluvaFD

func (v *VPTY2) SluvaFD() *PortFD

SluvaFD file descriptor for shell/app

type WriteCloserTicker

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

func (*WriteCloserTicker) Close

func (t *WriteCloserTicker) Close() error

func (*WriteCloserTicker) Write

func (t *WriteCloserTicker) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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