-
-
Notifications
You must be signed in to change notification settings - Fork 558
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
feat(rust): paginate help texts #5049
Conversation
@i-b-o-t thank you for spending time on this. A few quick things:
After that, I think we can merge this. |
Sure, I can do that. Also, I noticed that the exit status of the process should be either 0 or 2 depending on whether the help text is requested by the user explicitly or shown as a consequence of a usage error. By the same logic, in case no pagination is available, the output should go to Also, checking whether the pager is So give me a minute to take care of that. |
70aa6d7
to
d59ccf0
Compare
In individual commits for easy reviewing. The first one is still the same, except for rewording its log entry to lowercase. Rebasing with |
$ PAGER=false ./target/debug/ockam -h 1>/dev/null && echo OK
OK
$ PAGER=false ./target/debug/ockam 2>/dev/null || echo OK
OK
$ cat mock/swallow
#!/bin/sh
$ PAGER=./mock/swallow ./target/debug/ockam -h && echo OK
OK
$ PAGER=./mock/swallow ./target/debug/ockam || echo OK
OK
$ cat mock/less
#!/bin/sh
if test "${LESS}" = "-F"; then
echo OK
fi
$ PAGER=./mock/less ./target/debug/ockam
OK |
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.
Nice job @i-b-o-t! It's pretty much there but I've left some comments with potential improvements. Thanks for taking the time with this 🙏
💟 Thanks for your review! Please don't get too negative of an impression from me disagreeing in many places and let's not obscure the fact that it did raise valid points. |
e7364f5
to
ea8ab39
Compare
Behaves just like Git now, AFAICT rebased and ready. |
No problem! That's the whole point of doing code reviews right? We are here to learn from each other 👍 |
Hey @i-b-o-t , I was taking another look at the PR and I just wanted to clarify something. The PR looks great, it works as expected and we could merge it as is. All my last comments are just questions that would help me understand better your solution and small details that could be improved, but they won't block the PR from merging. That being said, feel free to mark the comments as resolved. We can tackle whatever is left in a separate PR. And thanks again for taking the time with this issue, it ended up being more tricky than I initially anticipated! |
Hey @adrianbenavides , thanks for giving it another chance - being able to take a step back and reconsider one's own position shows character! Defending it comes with wholehearted commitment, I know, nothing wrong with that as long as we realize when to hold on and take a break, a deep breath, another look or perspective into consideration. The simplest solutions is not always immediately obvious. I do think that Occam's Razor is a fine analogy to problem solving in software development and given the scope and constants that constrain us here and now, the implementation in a nutshell is as simple as it gets. Once we widen the scope (e.g. by introducing further command line options, changing the public interface, as we both have suggested above) or find a way to redefine the constants (e.g. by requesting additional Clap API), there is always room for improvement piecing the puzzle together in a coherent fashion. However, in order for these efforts to be both manageable and motivating, I think it is a good idea to chop things up into individual working steps and then working that plan without too much deviation. Of course there are exceptions, like something being completely infeasible, but we don't have that case here. Also, there is almost always some nits to pick on; doesn't mean we should just because we could (invert priorities).
Just pushed the squashed commit. EDIT: To complete my philosophical sermon and add another quote
I agree, plus hopefully merging better code than we would without. From that angle, nitpicking certainly has its place in reviews, as it can mean teaching each other (often ideally generalizable) details to be aware of, but it also bears the risk of wasting time and inverting priorities, so there's a pair of anti-forces that need to balanced. |
Thanks for the message @i-b-o-t , I really appreciate it 🙏 . One last thing: we require the commits to be signed. Let me know if you want me to sign it or you want to do it yourself. It's a one time operation and it's pretty quick to set up. |
That's not needed. Looks like your commit is signed but can't be verified. I think you have to upload your public key to your githu account for the verification to work. |
Head branch was pushed to by a user without write access
e85fda7
to
62f2cf5
Compare
using $PAGER if set, defaulting to `less` and falling back to `more` or no pagination if no pager is available. Addresses build-trust#3434
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.
Let's get this merged! Thanks again @i-b-o-t, this was a great contribution! 🚀
using $PAGER if set, defaulting to
less
and falling back tomore
or no pagination if no pager is available.Addresses #3434
Checks