A pager is great for long output and a nuisance for short output. I don’t want to press q to see three lines. less has an option that decides for you.
some-command | less -F
The manual says -F (--quit-if-one-screen) makes less exit automatically if the entire file can be displayed on the first screen. A two-line input printed both lines and returned straight to the prompt on less 590, with exit code 0, and a long input opens as a normal pager.
You can put the option in the LESS environment variable, which less reads before the command line, so options on the command line still win:
export LESS=-FRX
Here -R passes ANSI colour codes through in a limited way, so coloured output from ls or git stays coloured. -X disables sending the termcap initialization and deinitialization strings to the terminal. It is the one to add if the output of a short file disappears when less quits on your terminal.
One caveat: the variable is parsed before the command line, so an option you type still overrides it. The manual also says that if -r appears in LESS, it is treated as -R. Whichever pager options you set there apply to every program that runs less, so keep the list short.
Further reading: less(1) manual