walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

feat: Add or document inverse flag options #124

Open simsrw73 opened 1 year ago

simsrw73 commented 1 year ago

On Windows, using PowerShell Get-Help with $PAGER configured to use moar, it's cutting of lines when line numbers are displayed. I don't know if that's a bug in moar or PowerShell. PowerShell doesn't give any options for configuring paging at all. Line wrapping option doesn't help at all: words are still cut off. I can add the -no-linenumbers flag to the $MOAR variable to fix it, but then I ran in to the problem of how to show line numbers in other instances. It took me a long time before I blindly stumbled on the solution: -no-linenumbers=f. That's terribly ugly and not documented anywhere that I can see.

Can we have inverted flags for boolean options? -linenumbers or -show-linenumbers? Or at the very least, document how to supply values to boolean flags? This was not obvious to me.

walles commented 1 year ago

Sounds like fixing that "it's cutting of lines when line numbers are displayed" would be good as well.

Could you please add to this ticket:

Since I don't have access to any Windows machine I may not be able to repro this, but at least having a screenshot would be good.

walles commented 1 year ago

Also, just out of curiosity, how did you install moar on Windows?

simsrw73 commented 1 year ago

Installed with scoop package manager (https://scoop.sh)

❯ scoop info moar

Name : moar Description : A pager designed to work without any configuration Version : 1.11.4 Bucket : extras Website : https://github.com/walles/moar License : BSD-2-Clause-Views Updated at : 2023-01-11 11:50:52 Updated by : github-actions[bot] Installed : 1.11.4 Binaries : moar.exe

$PAGER=moar $MOAR='--style catppuccin-mocha --no-linenumbers' nolineno

$PAGER=moar $MOAR='--style catppuccin-mocha' lineno

simsrw73 commented 1 year ago

I can repro this on Linux.

walles commented 1 year ago

Is the problem that pwsh line breaks the help text before sending it to moar, just like man?

Ref: https://github.com/walles/moar/issues/119#issuecomment-1399616473

Otherwise, can you point out in detail one thing you'd like to look different in one of your screenshots?

walles commented 1 year ago

Did you want me to break this in to multiple issues... ?

Yes :)

simsrw73 commented 1 year ago

Is the problem that pwsh line breaks the help text before sending it to moar, just like man?

Yes. I don't believe this is an issue with moar. That's why I didn't write that issue up specifically. The help built-in function of pwsh formats the help document according to the width of the terminal, not accounting for moar or any other utility adding line numbers or any extra columns. It's not even useful to have line numbers in help, it only came up because line numbers is moar's default, which would be great if pwsh gave a way to override the PAGER command specifically for help.

So, by necessity, what I need is to be able to set MOAR to default to -no-linenumbers, and then invoke moar with line numbers in cases where I need it (probably with an alias). That is the main issue I was intending to bring up here: Adding/documenting inverse flags. Eg. -show-linenumbers / -no-linenumbers / -no-linenumbers=f. I hate that last syntax's double negative, but it works as is right now. It's just not documented.

Sorry we got side-tracked.