Bash-it / bash-it

A community Bash framework.
MIT License
14.3k stars 2.29k forks source link

[Bug]: man plugin can break less if you already have LESS set in your env #2261

Open bmjsmith opened 1 month ago

bmjsmith commented 1 month ago

Expected behavior

bash-it plugin enable man should enable colouring for man pages.

Current behavior

bash-it plugin enable man causes less and every command that uses it e.g. git log, man, bat to break with the cryptic error No tags file.

Possible solution

I have export LESS=--quit-on-intr --RAW-CONTROL-CHARS in my .bashrc.

When the man plugin is enabled I get: LESS=R-quit-on-intr --RAW-CONTROL-CHARS in my env.

I think this causes less to interpret this as -q -u -i -t etc. and the -t is enabling ctags support. There is no ctags file on my (default ubuntu) install. This causes every use of less to exit with the "No tags file" error. There's very little info around on what that means, this was hard to nail down.

This looks like a typo.

I think it should be export LESS="-R ${LESS:-}" or export LESS="--RAW-CONTROL-CHARS ${LESS:-}" or similar.

Context

Completely broke any command line tool using PAGER.

Steps to reproduce

bash-it plugin disable man
less somefile # works
export LESS="--quit-on-intr --RAW-CONTROL-CHARS"
bash-it plugin enable man
less somefile # probably doesn't work

Bash-it version

d985e4c

List of enabled plugins, themes and aliases

man

Bash version

5.2.21

Operating system and version

Ubuntu 24.04.01

bash-it doctor output

# How to get: bash-it doctor

Your ~/.bashrc

export LESS="--quit-on-intr --RAW-CONTROL-CHARS"

Notes

No response