cli / cli/cli

`gh` doesn't respect TERM, dumps colors / codes everywhere, breaks in dumb terms when prompting

Offen
#5,721 20 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
accessibility bug priority-3
Vorherrschende Sprache
Go
Sterne
46.3k
Forks
9k
Ø Merge
2 T. 6 Std.
Gemergte PRs (30 T.)
97

Beschreibung

### Describe the bug

```
9979 % gh --version
gh version 2.11.3 (2022-05-25)
https://github.com/cli/cli/releases/tag/v2.11.3
9980 % gh pr create
78? Where should we push the 'zenspider/fix/get-remote-branch' branch? [Use arrows to move, type to filter]
> zenspider/browse-at-remote
Skip pushing the branch
Cancel
7 C-c C-c8
```

### Steps to reproduce the behavior

1. open a shell "somewhere dumb". This can be a remote host that doesn't have your shiny mac terminal app, or in can be a shell in emacs, or whatever.
2. use any subcommand that prompts w/ those damn menus.
3. See above

### Expected vs actual behavior

If the termcap doesn't say you have the abilities to do cursor movements, don't do prompts... probably treat it like there's no TTY on stdin:

```
9981 % gh pr create < /dev/null
must provide `--title` and `--body` (or `--fill`) when not running interactively

Usage: gh pr create [flags]
...
```

Aside: I've found that EVERY damn command line tool written in go is guilty of this behavior and when I've gone to the libraries responsible for these interactions, they've been less than helpful. So, it's really on you to step up and make this tool useable in more than one context. PLEASE don't pass the buck to the go library you're using because they don't give a shit.

### Logs

see above

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der interaktiven Eingabeaufforderung, die von `gh pr create` verwendet wird, und reproduziere sie in einer Shell mit eingeschränkten Terminalfunktionen oder mit von `/dev/null` umgeleiteter stdin. Erledigt ist dies, wenn Eingabeaufforderungen in dummen Terminals keine rohen Cursor- oder Farb-Escape-Codes ausgeben und die nichtinteraktive Verwendung die erforderlichen Title- und Body-Flags meldet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
go
Bereich
cli
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.