cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
GNU General Public License v2.0
19.75k
stars
1.02k
forks
source link
corrupt output when piped to less, more, etc. #725
Closed
mcandre closed 1 year ago
Describe the bug
The output mangles when cloc is piped to other text processing commands, such as the
less
andmore
pagers.cloc should disable certain outputs when the current shell context is not a tty.
cloc; OS; OS version
To Reproduce
cloc . | less
Expected result
The output should look nearly the same in the pager as it does without a pager.
Observed
Additional context
The option
--progress-rate 0
cleans up most of the mess. A!isatty()
check would do well to automatically set progress rate to zero.That leaves
classified 4393 files^M
as the last bit of corruption.Tried
--hide-rate
, with no effect.Update
As a workaround, I am using the
--quiet
flag. This works well, and I would like to see it become the default behavior whenever the shell is not a tty.