-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve help text on narrow terminals #140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better!
Lack of |
I'll look over this more closely later today but overall I like it. It would be good to get the width of the terminal, but there doesn't seam to be a standard way to do this so this is something that could come later. |
When we do this, we also need to reflow the command description to match the terminal width (maxing out at some reasonable width). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea but this needs some polish.
- The SYNOPSIS for the root command is not wrapped:
USAGE
ipfs - Global p2p merkle-dag filesystem.
SYNOPSIS
ipfs [--config=<config> | -c] [--debug=<debug> | -D] [--help=<help>] [-h=<h>] [--local=<local> | -L] [--api=<api>] <command> ...
- When displaying sub commands, the description should wrap also, for example
ipfs filestore --help
:
SUBCOMMANDS
ipfs filestore dups - List blocks that are both in the filestore and standard block storage.
ipfs filestore ls [<obj>]... - List objects in filestore.
ipfs filestore verify [<obj>]... - Verify objects in filestore.
Use 'ipfs filestore <subcmd> --help' for more information about each command.
- In general we should dump the output of the help text for each sub command and look over it so it looks reasonable.
Damn. It's custom text. Options:
👍 |
Yeah, I didn't think about the fact that description text is already formatted for 80 cols. Hard coding the output to 80 cols makes sense for now.
I think that is the easiest option. |
Wrapped the subcommand text. We can fix the the root's synopsis when we merge this into go-ipfs.
|
USAGE section should also likely be wrapped:
So should the SUBCOMMANDS footer:
And some additional manual cleanup is required on
Easy way to dump all help text:
(but note it is slightly dangerous as it is directly executing each line of the |
One other minor nit, how the type field is presented is slightly confusing and causes me to have to pause a second to figure it out that it not another option:
Two suggestions (1) remove the space between the
What (2) might look like:
(1) saves space but I think (2) looks better, another option to save even more space (option (3))
I actually like (3) the best. Thoughts? |
faa3c14
to
f4e8230
Compare
I've lowered the minimum description width to 30 characters and raised the terminal width to 100 characters (nobody uses 80 character terminals anymore anyways). This was happening because we stop wrapping if we have less than 30 characters to work with for the description (we don't want one word on each line). |
77897ec
to
79620b6
Compare
I've gone with option 1. We can consider removing
I've rewritten the footer text to avoid this.
Done.
|
While it is true that nobody really uses 80, 80 is a universal (and safe) default. Many terminals still default to 80 charters wide until resizes. Hard coding anything other than 80 makes me unconformable. May I suggest something like:
That is if the command description does not start at say column 30, push it down to the next line. That is how output for other command or often formatted. For example
|
Mind leaving that for a future PR? IMO, this PR is strictly better than what we currently have and it's not really a priority (I can't dedicate any more time to it). |
I would say if we set the default width back to 80 then yes. I can also take over this P.R, but it won't be to next week. |
Instead of aligning flags in columns, display them right next to each other. Otherwise, they take up *way* too much space.
We could be fancier and figure out the terminal width but wrapping at a fixed 80c is a decent start.
Otherwise, `ipfs daemon --help` and `ipfs p2p --help` look terrible.
eae0186
to
000220a
Compare
@Stebalien I was gonna go ahead and fix ipfs/kubo#340 -- and I found this along the way and I think improved it at least to the point where it should resolve previous objects. The default width is now 80, and terminal width is detected using a semi-standard-ish package (it's from golang.org, even if it's a supplemental part of the crypto package) |
If the io.writer given to help text is the terminal, read its width. otherwise, use a default.
000220a
to
6a9e61f
Compare
✔️ (can't approve my own PR) |
ipfs add
now looks like:Was: