42 lines
593 B
Go
42 lines
593 B
Go
package vttools
|
|
|
|
import (
|
|
"io"
|
|
|
|
"git.sdf.org/CRThaze/vtTools/vt220"
|
|
)
|
|
|
|
type TermType struct {
|
|
id string
|
|
}
|
|
|
|
func (id TermType) ID() string {
|
|
return id.id
|
|
}
|
|
|
|
func (id TermType) String() string {
|
|
return id.ID()
|
|
}
|
|
|
|
var (
|
|
VT220Type = TermType{"vt220"}
|
|
)
|
|
|
|
type VTTerm interface {
|
|
io.Writer
|
|
Init()
|
|
TermID() string
|
|
Print(a ...any) (n int, err error)
|
|
Printf(format string, a ...any) (n int, err error)
|
|
Println(a ...any) (n int, err error)
|
|
}
|
|
|
|
func NewVTTerm(ttype TermType, w io.Writer) VTTerm {
|
|
var term VTTerm
|
|
switch ttype {
|
|
case VT220Type:
|
|
term = vt220.NewVT220(w)
|
|
}
|
|
return term
|
|
}
|