-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support externally supplying a terminal width when running outside a tty #4186
Comments
Already terminal_size doesn't do detection if STDOUT is not a tty:
Is that sufficient or something going wrong with it? Or are you wanting a different fallback terminal width? Also, as a workaround, you can implement this all yourself by calling |
Yes, this; I want to override the fallback terminal width in my script to have a consistent width no matter what terminal I'm running under.
Yep, it doesn't seem too hard (just misses out on a lot of the |
In my initial research on this, it sounded like Then I saw it suggested in https://clig.dev and saw it used in git which makes me feel more comfortable in supporting it. The question is what should the level of precedence be?
or
|
Also, I feel safer putting this into clap v4 rather than clap v3 (if we make the release window) |
Please complete the following tasks
Clap Version
v3.2.20
Describe your use case
I am attempting to verify my readme contains the latest version of the help text from my utility. To do so I need an appropriately widthed help text to compare against (and auto-update from).
Describe the solution you'd like
I'm not sure what the best interface for this would be. One thought I had was to obey the
COLUMNS
variable if that is set and the output is not a tty, that would maketext="$(COLUMNS=60 cargo run -- --help)"
work fine.Alternatives, if applicable
Locally I found a way to get a sub-tty with a limited width
but unfortunately that doesn't work in GitHub Actions for some unknown reason.
Additional Context
No response
The text was updated successfully, but these errors were encountered: