-
Notifications
You must be signed in to change notification settings - Fork 22
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
Increase output width of all commands #643
Conversation
ae4c862
to
6444b12
Compare
src/globus_cli/parsing/commands.py
Outdated
term_size = get_terminal_size(fallback=(80, 20)) | ||
kwargs["context_settings"]["max_content_width"] = int( | ||
0.8 * term_size.columns | ||
) |
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.
One thing which surprised me with this change is that globus transfer -h | cat
became narrower.
I'm wondering if we should "widen out" if the terminal width is small, which will also cover the fallback case.
So, something like (and don't mind exactly how I write this please 😉 ):
cols = get_terminal_size(fallback=...).columns
if cols < 100: cols
else: cols * 0.8
Does that seem nice?
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.
Oh, right. The fallback will take over for the pipe case, so we don't want to again take 80% of that.
I also wonder about cases where get_terminal_size
could fail; I figure it doesn't hurt to catch those.
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.
Just looking at the py3.10 source for get_terminal_size I think this is already an "error handling variant" of os.get_terminal_size(sys.stdout.fileno())
.
I would assume that it works as expected and we can handle any bug reports if someone finds a context where it does not. It doesn't look like there have been changes there since py3.5, so I bet it's pretty solid.
I dropped the helptext from
I think that's a huge improvement, and it's equally striking with commands that have shorter helptext. I have a change to the example helptext with shorter jmespath helpCompare this:
vs main:
I would like to have the text widen to full width on very narrow terminals -- since I think that's an easy improvement -- and then we can merge. |
9542a7a
to
efe8829
Compare
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 see the change I asked for is in. Although a somewhat low-key improvement, I'm quite excited for this!
Use the
context_settings
argument toclick.Command
to adjust max content width to 80% of the terminal size.