-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdoc.go
More file actions
51 lines (51 loc) · 1.7 KB
/
doc.go
File metadata and controls
51 lines (51 loc) · 1.7 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Package libghostty provides Go bindings for libghostty-vt, a
// virtual terminal emulator library from the Ghostty project.
//
// # Getting Started
//
// Create a terminal with [NewTerminal], feed it input with
// [Terminal.VTWrite] (or [Terminal.Write] for an [io.Writer]), and
// inspect state through data getters such as [Terminal.CursorX],
// [Terminal.Title], and [Terminal.ActiveScreen]. When finished, call
// [Terminal.Close] to release resources.
//
// term, err := libghostty.NewTerminal(
// libghostty.WithSize(80, 24),
// libghostty.WithMaxScrollback(1000),
// )
// if err != nil {
// log.Fatal(err)
// }
// defer term.Close()
//
// term.VTWrite([]byte("Hello, world!\r\n"))
//
// # Effects
//
// The terminal communicates side-effects back to the host through
// effect callbacks. Register them at creation time with functional
// options like [WithWritePty], [WithBell], and [WithEnquiry], or
// on a live terminal with [Terminal.SetEffectWritePty] and friends.
//
// [WithWritePty] is the most common effect — it delivers data that
// the terminal wants to send back to the pty (e.g. query responses):
//
// term, _ := libghostty.NewTerminal(
// libghostty.WithSize(80, 24),
// libghostty.WithWritePty(func(_ *libghostty.Terminal, data []byte) {
// os.Stdout.Write(data)
// }),
// )
//
// # Terminal Options
//
// Terminal properties can be changed after creation with setter
// methods such as [Terminal.SetColorForeground],
// [Terminal.SetColorBackground], [Terminal.SetColorPalette],
// [Terminal.SetTitle], and [Terminal.SetPwd].
//
// # Linking
//
// This is a cgo package. By default it links the shared library via
// pkg-config. Build with "-tags static" to link statically instead.
package libghostty