News for hackers. Stuff that matters.
Re:I made an ls alternative for my personal use by burntsushi on Sunday November 24, 2024 @02:17PM (#42229719)
You can still chain ripgrep. I specifically designed it so that you can chain it just like you would a normal grep.

It does indeed also include other functionality that might traditionally be left to other tools (like filtering files). But this is nothing that GNU grep wasn't already doing itself anyway.

IMO, it's better to view the Unix philosophy as a means to an end and not an end to itself. And IMO, it's important to weigh the benefits of coupling to the user experience.

Re:I made an ls alternative for my personal use by fsckboy on Sunday November 24, 2024 @03:22PM (#42230212)
>view the Unix philosophy as a means to an end and not an end to itself

it won't be a means to an end any more if you don't preserve it, so not breaking that aspect of it has to be one of your ends. if you use it to take ls to a new place but that place is not within the ecosystem, it will be an evolutionary dead end, or worse, the first meteor in the meteor storm that ends all life.

current/traditional unix may not be the be-all/end-all, but replacing it/changing it requires viewing it comprehensively and changing all the tools at once or having a plan to. A good example of this is Plan9

Re:I made an ls alternative for my personal use by burntsushi on Sunday November 24, 2024 @09:16PM (#42232595)
I don't know what you're trying to say and I don't see how it's in conflict with anything I've said.
Re:I made an ls alternative for my personal use by fsckboy on Monday November 25, 2024 @01:05AM (#42233665)
>not an end to itself

it is an end to itself. the reason it's a means to an end is because that was its end goal. in being a means to an end, it is an end (its end) unto itself, opposite to what you said, imho

Re:I made an ls alternative for my personal use by burntsushi on Monday November 25, 2024 @10:58AM (#42237303)
I still can't parse what you're saying. The Unix philosophy is a means to an end, where the ultimate end is improved user experience. The means is de-coupling and composition. But there are other means to improving the user experience.

> in being a means to an end, it is an end (its end) unto itself

This either makes zero sense or is vacuously true and clearly not in conflict with what I'm saying.

Re:I made an ls alternative for my personal use by L3viathan on Sunday November 24, 2024 @03:25PM (#42230228)
I think ripgrep specifically is counted in the comment you reply to as a tool that _does_ do one thing well, and that one should use it (or grep) in combination with an ls, instead of giving ls filtering abilities.
Re:I made an ls alternative for my personal use by burntsushi on Sunday November 24, 2024 @09:18PM (#42232613)
I suppose. But I wanted to point out that ripgrep couples functionality, specifically in contradiction to the Unix philosophy. And actually, many command, including "traditional" tooling, so as well.

The point is that many pay lip service to the Unix philosophy as if it were an end. But it isn't.

Re:I made an ls alternative for my personal use by sudahtigabulan on Sunday November 24, 2024 @06:45PM (#42231671)
> You can still chain ripgrep. I specifically designed it so that you can chain it just like you would a normal grep.

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.

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.