Skip to content
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

Use -R instead of -r for fallback pager command #5759

Merged
merged 1 commit into from
Apr 4, 2023

Conversation

mrsdizzie
Copy link
Contributor

Not all versions of less offer -r as seen in #5758

Also, modern versions of LESS have the following warning when viewing man pages:

From man less

USE OF THE -r OPTION IS NOT RECOMMENDED.

-R or --RAW-CONTROL-CHARS is defined as:

 Like -r, but only ANSI "color" escape sequences and OSC 8 hyperlink sequences are output in "raw" form.

Reference: https://man7.org/linux/man-pages/man1/less.1.html

Fixes #5758

Not all versions of less offer -r as seen in wp-cli#5758

Also, modern versions of LESS have the following warning when viewing man pages:

"USE OF THE -r OPTION IS NOT RECOMMENDED."

-R or --RAW-CONTROL-CHARS is defined as:

 Like -r, but only ANSI "color" escape sequences and OSC 8 hyperlink sequences are output in "raw" form.

Fixes wp-cli#5758
@mrsdizzie mrsdizzie requested a review from a team as a code owner April 4, 2023 14:19
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know (or can you track down) when -R was introduced?

I have a slight backwards compat concern with this change, although it wouldn't be a huge detail because wp help is user-initated. I would feel more comfortable if we knew when -R was introduced, and which version of less was included on some major distros.

@mrsdizzie
Copy link
Contributor Author

According to git blame of https://github.com/gwsw/less/blame/f229eab7eda5f31670b9ac2dd327fb148765e420/less.nro.VER#L979 it was around 17 years ago : )

@mrsdizzie
Copy link
Contributor Author

Out of interest was able to track it back to https://www.greenwoodsoftware.com/less/news.346.html so it is available as of 5 Nov 1999:
New option -R (--RAW-CONTROL-CHARS) is like -r but handles long (wrapped) lines correctly, as long as the input contains only normal text and ANSI color escape sequences.

@danielbachhuber
Copy link
Member

@mrsdizzie Great, thanks for doing that discovery.

It looks like there wasn't any discussion around less -r vs. less -R in the original pull request (#552), so I think it's fine to make the switch.

@danielbachhuber danielbachhuber added this to the 2.8.0 milestone Apr 4, 2023
@danielbachhuber danielbachhuber self-requested a review April 4, 2023 19:12
@danielbachhuber danielbachhuber merged commit 7c59995 into wp-cli:main Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to less -R for default pager
2 participants