Re:I made an ls alternative for my personal use
by burntsushi on Sunday November 24, 2024 @07:06PM
(#42231808)
> I don't expect the tools to change their output format on me.
You probably do! If you've ever used `ls`, then it does exactly this.
Re:I made an ls alternative for my personal use
by sudahtigabulan on Sunday November 24, 2024 @07:20PM
(#42231892)
If you mean the ANSI color stuff, yes - I do expect these to disappear :)
I meant the "shape" of the output. It just doesn't follow the principle of least surprise.
edit: you probably meant the columns. I forgot about that, I haven't parsed ls(1) output in ages ;)
Re:I made an ls alternative for my personal use
by burntsushi on Sunday November 24, 2024 @09:12PM
(#42232575)
Yes. The columns. The point is that commands have been changing their output format, not just their colors, based on tty for ages. So the criticism you lodge against ripgrep also applies to some of the most core commands you probably use daily.
I would be quite surprised if you didn't rely on this without even knowing it. Even a simple `ls | wc -l` relies on it.
I say this because it's tiring to see folks lament about this feature in ripgrep as if it's something new that ripgrep does. It's not. It's a well established idiom among Unix command line tools.
Re:I made an ls alternative for my personal use
by volemo on Monday November 25, 2024 @06:37AM
(#42235383)
Isn’t “don’t parse ls” like the third commandment of Unix?
Re:I made an ls alternative for my personal use
by burntsushi on Monday November 25, 2024 @10:59AM
(#42237319)
You've never done `ls | wc -l`?
Re:I made an ls alternative for my personal use
by BenjiWiebe on Monday November 25, 2024 @11:50PM
(#42242696)
I've always assumed that ls doesn't change it's output when piped; I've always done ls -1|wc -l. I guess I can save on a few keystrokes now.
Headings on when isatty and off when piping the output put me off when I first tried ripgrep. I don't expect the tools to change their output format on me.
Luckily, you made this behavior configurable, so I'm a happy convert now.