Commit 1712c81b0a
1712c81b0af4daa50780f4b1c4947474ba4dd8a6
parent: dd06e80a07
Verified · cmc
cmc <hello@cleberg.net> · 2026-09-24 04:29 UTC
gitbay: GITBAY_TERM=off sends no terminal size
Ref #254
Layout: unified · split
.gitbay/wiki/Users.org
+4
| @@ -775,6 +775,10 @@ list. The server then prints: |
| 775 | =GITBAY_PAGER= turns paging off. Paging never applies to =--follow=, |
775 | =GITBAY_PAGER= turns paging off. Paging never applies to =--follow=, |
| 776 | =--json=, or piped output. |
776 | =--json=, or piped output. |
| 777 | |
777 | |
| |
778 | =GITBAY_TERM=off= stops the CLI sending =--term= at all, for an |
| |
779 | instance older than v1.36.0, which refuses the argument as an unknown |
| |
780 | command. |
| |
781 | |
| 778 | Stock ssh without the CLI's multiplexing gets the plain output unless |
782 | Stock ssh without the CLI's multiplexing gets the plain output unless |
| 779 | it passes the same leading argument or sets the environment variable |
783 | it passes the same leading argument or sets the environment variable |
| 780 | sshd is told to accept: |
784 | sshd is told to accept: |
CHANGELOG.org
+5
| @@ -8,6 +8,11 @@ anything beyond "replace the binary and restart" is needed. |
| 8 | |
8 | |
| 9 | Terminal output for the CLI (#254). |
9 | Terminal output for the CLI (#254). |
| 10 | |
10 | |
| |
11 | *Upgrade note.* Upgrade the instance before the CLI: an older server |
| |
12 | refuses the CLI's leading =--term= argument as an unknown command. |
| |
13 | Against an older instance, set =GITBAY_TERM=off= and the CLI sends no |
| |
14 | terminal size. |
| |
15 | |
| 11 | - At a terminal, lists print under a header, fitted to the width, with |
16 | - At a terminal, lists print under a header, fitted to the width, with |
| 12 | states in colour and relative ages; the next page is a command on |
17 | states in colour and relative ages; the next page is a command on |
| 13 | stderr. Piped output keeps the same tab-separated rows, with |
18 | stderr. Piped output keeps the same tab-separated rows, with |
cmd/gitbay/ssh.go
+3 −2
| @@ -114,9 +114,10 @@ var noColor bool |
| 114 | |
114 | |
| 115 | // termValue is GITBAY_TERM for this invocation: the terminal's width, |
115 | // termValue is GITBAY_TERM for this invocation: the terminal's width, |
| 116 | // and whether colour is wanted. Empty when stdout is not a terminal, |
116 | // and whether colour is wanted. Empty when stdout is not a terminal, |
| 117 | // so piped output stays the rows stock ssh prints. |
117 | // so piped output stays the rows stock ssh prints, and when GITBAY_TERM |
| |
118 | // is "off", for an instance older than --term. |
| 118 | func termValue(isTerminal bool, cols int, env func(string) string) string { |
119 | func termValue(isTerminal bool, cols int, env func(string) string) string { |
| 119 | if !isTerminal || cols < 40 { |
120 | if !isTerminal || cols < 40 || env("GITBAY_TERM") == "off" { |
| 120 | return "" |
121 | return "" |
| 121 | } |
122 | } |
| 122 | v := strconv.Itoa(cols) |
123 | v := strconv.Itoa(cols) |
cmd/gitbay/term_test.go
+1
| @@ -22,6 +22,7 @@ func TestTermValue(t *testing.T) { |
| 22 | {true, 120, map[string]string{"NO_COLOR": "1"}, false, "120"}, |
22 | {true, 120, map[string]string{"NO_COLOR": "1"}, false, "120"}, |
| 23 | {true, 120, map[string]string{"TERM": "dumb"}, false, "120"}, |
23 | {true, 120, map[string]string{"TERM": "dumb"}, false, "120"}, |
| 24 | {true, 120, nil, true, "120"}, |
24 | {true, 120, nil, true, "120"}, |
| |
25 | {true, 120, map[string]string{"GITBAY_TERM": "off"}, false, ""}, |
| 25 | } |
26 | } |
| 26 | for _, c := range cases { |
27 | for _, c := range cases { |
| 27 | noColor = c.noColor |
28 | noColor = c.noColor |