Skip to content

Commit

Permalink
docs: allocate pty colors example
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed May 2, 2024
1 parent 4264378 commit 11ae75c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/pty/main.go
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/charmbracelet/ssh"
"github.com/charmbracelet/wish"
"github.com/charmbracelet/wish/activeterm"
"github.com/charmbracelet/wish/bubbletea"
"github.com/charmbracelet/wish/logging"
)

Expand All @@ -35,9 +36,12 @@ func main() {
func(next ssh.Handler) ssh.Handler {
return func(sess ssh.Session) {
pty, _, _ := sess.Pty()
r := bubbletea.MakeRenderer(sess)
wish.Printf(sess, "Hello, world!\r\n")
wish.Printf(sess, "Term: "+pty.Term+"\r\n")
wish.Printf(sess, "PTY: "+pty.Slave.Name()+"\r\n")
wish.Printf(sess, "Term: %s\r\n", pty.Term)
wish.Printf(sess, "PTY: %s\r\n", pty.Slave.Name())
wish.Printf(sess, "FD: %d\r\n", pty.Slave.Fd())
wish.Printf(sess, "Has dark background?: %v\r\n", r.HasDarkBackground())
next(sess)
}
},
Expand Down

0 comments on commit 11ae75c

Please sign in to comment.