-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
pty.go
29 lines (22 loc) · 928 Bytes
/
pty.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package pty
import (
"image"
"github.com/srlehn/termimg/internal/errors"
"github.com/srlehn/termimg/term"
)
type PTYRunFunc = func(pty string, pidTerm uint) error
// PTYRun starts a pseudo terminal and runs a function on its pty.
func PTYRun(f PTYRunFunc, termCmd ...string) error {
if f == nil {
return errors.NilParam()
}
// TODO use default terminal: xterm, conhost, Terminal.app
if len(termCmd) == 0 {
return errors.New(`no command`)
}
return ptyRun(termCmd, f)
}
type DrawFuncProvider = func(img image.Image, cellBounds image.Rectangle) DrawFunc
// DrawFunc returns the area that will be screenshot by TakeScreenshotFunc and the scale for unstretching a possibly contained image
type DrawFunc = func(tm *term.Terminal, dr term.Drawer, rsz term.Resizer, cpw, cph uint) (areaOfInterest image.Rectangle, scaleX, scaleY float64, e error)
type TermProviderFunc = func(ttyFile string) (*term.Terminal, error)