Use a pager for help output
Description
Automatically use a pager for the help
Depends on https://github.com/minio/cli/pull/8
Motivation and Context
Add pagination when printing long help message
How to test this PR?
mc cp -h
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Optimization (provides speedup with no functional changes)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [ ] Fixes a regression (If yes, please add
commit-idorPR #here) - [ ] Unit tests added/updated
- [ ] Internal documentation updated
- [ ] Create a documentation update request here
@vadmeste Would you mind if I try to implement without invoking less?
@vadmeste Would you mind if I try to implement without invoking less?
No problem, do you know any good library for that ? also I found this PR doesn't work in some cases, unfortunately the cli library calls os.Exit() in certain cases, this is maybe not easy to implement
Yeah, os.Exit is always going to be a problem. So this only for help (for now?)
While a full 'less' would be great, maybe just paging would be fine.
External programs are always going to be flaky, so while it has the upside of all the "less" features, if they need that then mc --help|less is the way to go.
Rather than using less you can use this https://github.com/charmbracelet/bubbletea/tree/master/examples/pager @vadmeste
Rather than using less you can use this https://github.com/charmbracelet/bubbletea/tree/master/examples/pager @vadmeste
Yes, I didn't see this when I went through their docs, will try it out
I made some progress, the code currently is little bit complex because I had to connect cli with bubbletea but overall it is fine, can you test this @harshavardhana before I make the remaining changes ? hopefully no surprises after that
It works fine @vadmeste however we have to show how to quit at the bottom page otherwise users won't know how to quit the pager.
It works fine @vadmeste however we have to show how to quit at the bottom page otherwise users won't know how to quit the pager.
okay, there are still more edge cases that I need to address, they should be fixed today
This PR https://github.com/minio/cli/pull/9/files is also needed. Otherwise all of this won't work :)
PTAL at the conflict @vadmeste
Is there an option included to disable this?
It's pretty cumbersome if the help output disappears while you're trying to cobble together a command with multiple flags and one can't look at the output history because it disappears with the pager.
mc cp -h | cat is a dumb workaround.
We are going to fix the pager for it to stay the output..
Is there an option included to disable this?
@zeeZ I think you want this PR, https://github.com/minio/mc/pull/4289, it keeps the help screen after quitting it