• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pomerium / pomerium / 21458011535

28 Jan 2026 10:32PM UTC coverage: 44.719% (-1.3%) from 46.02%
21458011535

push

github

web-flow
ssh: reverse tunnel status tui improvements (#6004)

This PR includes significant changes to the structure and configuration
of the reverse tunnel status TUI, as well as new components and
functionality.

The TUI is much more configurable than it was before, although the
current configuration is such that it doesn't look much different.

High level changes:
- Theme and colors are now fully configurable and all styling is derived
from the theme instead of hard-coded.
- Size/layout/presence of components is now configurable within the CLI
controller.
- New persistent header bar with highly configurable segments
- UI elements have been organized into a widget library with consistent
code style
- New highly configurable context menus and dialogs
- Support for inline editing of table data
- Basic user preference management system
- Support for active route health checks
- Copy-to-clipboard support (with terminal capability detection)

186 of 3203 new or added lines in 56 files covered. (5.81%)

26 existing lines in 8 files now uncovered.

30923 of 69150 relevant lines covered (44.72%)

102.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.24
/pkg/ssh/cli.go
1
package ssh
2

3
import (
4
        "errors"
5
        "fmt"
6
        "io"
7
        "reflect"
8

9
        tea "charm.land/bubbletea/v2"
10
        "github.com/spf13/cobra"
11

12
        "github.com/pomerium/pomerium/pkg/ssh/api"
13
)
14

15
type internalCLI struct {
16
        *cobra.Command
17
        programDone chan struct{}
18
        msgQueue    chan tea.Msg
19
        ptyInfo     api.SSHPtyInfo
20
        stdin       io.Reader
21
        stdout      io.Writer
22
        stderr      io.Writer
23
}
24

25
func newInternalCLI(
26
        ptyInfo api.SSHPtyInfo,
27
        msgQueue chan tea.Msg,
28
        stdin io.Reader,
29
        stdout io.Writer,
30
        stderr io.Writer,
31
) *internalCLI {
29✔
32
        cmd := &cobra.Command{
29✔
33
                Use: "pomerium",
29✔
34
                PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
52✔
35
                        _, cmdIsInteractive := cmd.Annotations["interactive"]
23✔
36
                        if reflect.ValueOf(ptyInfo).IsNil() && cmdIsInteractive {
24✔
37
                                return fmt.Errorf("\x1b[31m'%s' is an interactive command and requires a TTY (try passing '-t' to ssh)\x1b[0m", cmd.Use)
1✔
38
                        }
1✔
39
                        return nil
22✔
40
                },
41
        }
42

43
        cmd.CompletionOptions.DisableDefaultCmd = true
29✔
44
        // set a non-nil args list, otherwise it will read from os.Args by default
29✔
45
        cmd.SetArgs([]string{})
29✔
46
        cmd.SetIn(stdin)
29✔
47
        cmd.SetOut(stderr) // usage messages
29✔
48
        cmd.SetErr(stderr) // error messages
29✔
49
        cmd.SilenceUsage = true
29✔
50
        cmd.SilenceErrors = true
29✔
51

29✔
52
        cli := &internalCLI{
29✔
53
                Command:     cmd,
29✔
54
                programDone: make(chan struct{}),
29✔
55
                msgQueue:    msgQueue,
29✔
56
                ptyInfo:     ptyInfo,
29✔
57
                stdin:       stdin,
29✔
58
                stdout:      stdout,
29✔
59
                stderr:      stderr,
29✔
60
        }
29✔
61

29✔
62
        return cli
29✔
63
}
64

65
// PtyInfo implements InternalCLI.
NEW
66
func (cli *internalCLI) PtyInfo() api.SSHPtyInfo {
×
67
        return cli.ptyInfo
×
68
}
×
69

70
// Stderr implements InternalCLI.
71
func (cli *internalCLI) Stderr() io.Writer {
10✔
72
        return cli.stderr
10✔
73
}
10✔
74

75
// Stdin implements InternalCLI.
76
func (cli *internalCLI) Stdin() io.Reader {
×
77
        return cli.stdin
×
78
}
×
79

80
// Stdout implements InternalCLI.
81
func (cli *internalCLI) Stdout() io.Writer {
×
82
        return cli.stdout
×
83
}
×
84

85
// SendTeaMsg implements InternalCLI.
86
func (cli *internalCLI) SendTeaMsg(msg tea.Msg) {
×
87
        select {
×
88
        case <-cli.programDone:
×
89
        case cli.msgQueue <- msg:
×
90
        }
91
}
92

93
// SendTeaMsg implements InternalCLI.
94
func (cli *internalCLI) RunProgram(prog *tea.Program) (tea.Model, error) {
×
95
        select {
×
96
        case <-cli.programDone:
×
97
                return nil, errors.New("RunProgram can only be called once")
×
98
        default:
×
99
        }
100
        defer close(cli.programDone)
×
101
        go func() {
×
102
                for {
×
103
                        select {
×
104
                        case <-cli.programDone:
×
105
                                return
×
106
                        case msg := <-cli.msgQueue:
×
107
                                prog.Send(msg)
×
108
                        }
109
                }
110
        }()
111
        return prog.Run()
×
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc