walles / moar

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

Allow inversion of no-xxx flags. #197

Closed eode closed 8 months ago

eode commented 9 months ago

Sometimes, as with line numbering in my case, i want line numbering off by default, but to add it when needed.

Turning it off by default is simple enough, but turning it back on isn't easily apparent.

What I'd like:

So that if moar is aliased to, for example, moar -no-linenumbers, then it's simple enough to just type moar -linenumbers and get linenumbers -- though the underlying command moar is receiving is moar -no-linenumbers -linenumbers

I think this is an elegant solution because:

Thanks for making the world moar nice. Before if found this program, I had less.

walles commented 9 months ago

As a workaround (not a fix), pressing <- (left arrow key) when inside of moar will get you line numbers.

Obvious to me because I wrote it, not sure how obvious it is for anybody else :).

walles commented 9 months ago

Even if I agree your request makes sense, AFAICT flag from the standard library (which is what I'm using for command line parsing) doesn't support what you're after.

And adding a separate -linenumbers option wouldn't work either, because flag hides from me the order in which the command line arguments showed up.

So it seems this would involve quite some work, including replacing the command line parser.

How do you feel about the press-left-arrow-key solution / workaround?

walles commented 9 months ago

Another (not super great) workaround is to specify --no-linenumbers=false.

eode commented 8 months ago

Ah, yeah.. I know the 'underlying lib doesn't support this' problem. :-)

It's not such an issue that I'd do a rework to change an underlying lib if it were my tool. Switching line numbers on and off with the hotkey works well enough for me.

As far as I'm concerned, you can close this.