Repository navigation
Description
The help text output by gh help (or just gh with no other arguments) is just slightly wider than 80 columns, but still line-wrapped at like 86 columns wide or whatever. That causes it to look especially bad in an 80-character window, without realizing any of the potential benefits from wider formatting.
Specifically, this is the output in an 80×24 terminal window:
$ gh
Work seamlessly with GitHub from the command line.
USAGE
gh <command> <subcommand> [flags]
CORE COMMANDS
issue: Create and view issues
pr: Create, view, and checkout pull requests
repo: Create, clone, fork, and view repositories
ADDITIONAL COMMANDS
alias: Create command shortcuts
api: Make an authenticated GitHub API request
completion: Generate shell completion scripts
config: Manage configuration for gh
gist: Create gists
help: Help about any command
FLAGS
--help Show help for command
--version Show gh version
EXAMPLES
$ gh issue create
$ gh repo clone cli/cli
$ gh pr checkout 321
ENVIRONMENT VARIABLES
GITHUB_TOKEN: an authentication token for API requests. Setting this avoids be
ing
prompted to authenticate and overrides any previously stored credentials.
GH_REPO: specify the GitHub repository in "OWNER/REPO" format for commands tha
t
otherwise operate on a local repository.
GH_EDITOR, GIT_EDITOR, VISUAL, EDITOR (in order of precedence): the editor too
l to use
for authoring text.
BROWSER: the web browser to use for opening links.
DEBUG: set to any value to enable verbose output to standard error. Include va
lues "api"
or "oauth" to print detailed information about HTTP requests or authentication
flow.
GLAMOUR_STYLE: the style to use for rendering Markdown. See
https://github.com/charmbracelet/glamour#styles
NO_COLOR: avoid printing ANSI escape sequences for color output.
LEARN MORE
Use "gh <command> <subcommand> --help" for more information about a command.
Read the manual at https://cli.github.com/manual
FEEDBACK
Fill out our feedback form https://forms.gle/umxd3h31c7aMQFKG7
Open an issue using “gh issue create -R cli/cli”
(The output above is collected from this version of the gh tool, installed on Fedora 32 from the official downloadable RPM package:)
$ gh --version
gh version 0.11.1 (2020-07-28)
https://github.com/cli/cli/releases/tag/v0.11.1My argument here is not that the text has to be formatted to only 80 columns wide. Only that if it isn't going to fit in 80 columns, there should be no fixed-width line-wrapping, period.
Ideally the output would auto-wrap to fit the current terminal width. But failing that, it would actually be better to just output one line per paragraph, without doing any wrapping. This is one of those situations where doing the wrong thing ends up being worse than doing nothing.
Activity
mislav commentedon Jul 31, 2020
Fully agreed! I was considering a help system that reformats all prose to fit available width, but to also cap it at a certain maximum width for readability.
In the meantime, you can try viewing our man pages:
man gh,man gh-pr-create, etc. They are a little rough, but you should have no line-wrapping problems there.That would be good for small- to medium-sized terminal windows, but for extremely wide terminal windows that might lead to very long lines, which is hard to read.
ferdnyc commentedon Jul 31, 2020
A fair point, there definitely should be some maximum. Print media formats prose into columns for a reason.
ferdnyc commentedon Aug 1, 2020
Heh. Well, actually (from
gh-api(1)):That's not actually so bad, though. Unfortunately, there's also a missing content issue.
vs.
Looks like the first omission (which also triggers that error message at the start of the output) happens because
'--field'falls right at the start of a line (line 55 ingh-api.1), and I guess a line beginning with'is interpreted as the start of some sort of command sequence, in nroff. The second one,'pageinfo{...'is also at the beginning of a line, so same thing.mislav commentedon Aug 5, 2020
Thanks for looking into this! It definitely looks like some markdown-to-roff encoding bug. We already have on our roadmap for this month an item to refresh our docs, particularly regarding how they are rendered to man and HTML formats. 👍