-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
based on #219 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
- Loading branch information
1 parent
9ab015a
commit 50a706e
Showing
6 changed files
with
64 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build !linux && !darwin && !freebsd && !dragonfly && !netbsd && !openbsd && !solaris | ||
// +build !linux,!darwin,!freebsd,!dragonfly,!netbsd,!openbsd,!solaris | ||
|
||
package bubbletea | ||
|
||
import ( | ||
tea "github.com/charmbracelet/bubbletea" | ||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/ssh" | ||
"github.com/muesli/termenv" | ||
) | ||
|
||
func makeIOOpts(s ssh.Session) []tea.ProgramOption { | ||
return []tea.ProgramOption{ | ||
tea.WithInput(s), | ||
tea.WithOutput(s), | ||
} | ||
} | ||
|
||
func newRenderer(s ssh.Session) *lipgloss.Renderer { | ||
return lipgloss.NewRenderer(s, termenv.WithColorCache(true)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris | ||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris | ||
|
||
package bubbletea | ||
|
||
import ( | ||
tea "github.com/charmbracelet/bubbletea" | ||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/ssh" | ||
"github.com/muesli/termenv" | ||
) | ||
|
||
func makeIOOpts(s ssh.Session) []tea.ProgramOption { | ||
pty, _, ok := s.Pty() | ||
if !ok || s.EmulatedPty() { | ||
return []tea.ProgramOption{ | ||
tea.WithInput(s), | ||
tea.WithOutput(s), | ||
} | ||
} | ||
|
||
return []tea.ProgramOption{ | ||
tea.WithInput(pty.Slave), | ||
tea.WithOutput(pty.Slave), | ||
} | ||
} | ||
|
||
func newRenderer(s ssh.Session) *lipgloss.Renderer { | ||
pty, _, _ := s.Pty() | ||
return lipgloss.NewRenderer(pty.Slave, termenv.WithColorCache(true)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters