4 ms·
It's nothing missing, it's just different for no clear reason, and that means remembering different syntaxes depending on which tool I am using at the moment. T
by hvdijk 4y ago
It's nothing missing, it's just different for no clear reason, and that means remembering different syntaxes depending on which tool I am using at the moment. The one I use most: GNU grep and git grep use `\<` and `\>` for word boundaries, with ripgrep that produces "error: unrecognized escape sequence" and I have to use `\b` instead. (Note: GNU grep and git grep do support `\b` too.)
> Maybe they just mean: if you want to see how man pages are produced in Rust programs, then take a look at how these programs do it.
I do not think that is what they mean. A man page looks the same to the end user no matter what tools are used to produce it.
> Notice also that the OP started this thought with "alternative to coreutils" program.
The start of the thought was "Conform to tools that share a similar niche." ripgrep and fd being implemented in Rust are details that are not relevant to an end user. For ripgrep, the "tools that share a similar niche" would not be "tools that are implemented in Rust", it would be "tools that search in files using regular expressions", and I would be happier with a tool that matches the other tools that I use. So actually I completely agree with the author's principle, I just think it was a bad example.
- burntsushi 4y ago> I do not think that is what they mean. A man page looks the same to the end user no matter what tools are used to produce it. And you can look to ripgrep to learn how to produce one! And in particular, how to do it without duplicating docs. In any case, my point is that maybe there is a more expansive viewpoint here that makes sense instead of honing down on to something hyper specific. > It's nothing missing, it's just different for no clear reason, and that means remembering different syntaxes depending on which tool I am using at the moment. Right, so you want a POSIX compatible tool because POSIX is what you're used to and you don't want to use any other interface. Which is fine. Keep using the old stuff. I don't see any good reason to exactly imitate POSIX when I can go build something that I think is better without being constrained by POSIX. For example, I think just having \b is better than having both \< and \>. > I just think it was a bad example. I don't. There's a lot that tools like ripgrep and fd do that the old tools don't do that turn it into its own niche. Like enabling "smart" filtering by default and other things that many consider to be quality of life improvements. So if you're in that niche, then looking to those tools for what they do is a good idea.
- hvdijk 4y ago> Right, so you want a POSIX compatiblr tool because POSIX is what you're used to and you don't want to use any other interface. Well, I would want to use a single RE syntax if possible. It does not have to be POSIX BRE with GNU extensions but that's what is used by the other tools I use. Looking closer, GNU grep, git grep, ripgrep all support PCRE. That might be an okay alternative. It would take some time and effort to switch over. I do not know yet whether it would be worth the effort, but getting used to a different syntax that's used by a wide number of tools seems more useful than getting used to a different syntax that's used by a single tool, no matter how useful the tool. > Which is fine. Keep using the old stuff. I don't see any good reason to exactly imitate POSIX when I can go build something that I think is better without being constrained by POSIX. For example, I think just having \b is better than having both \< and \>. To be clear, \< and \> are GNU extensions, not part of POSIX. I can't really see how making \< and \> errors is better for users than supporting it in addition to \b. I can see an argument that it's not worth the cost to implement the feature, and that's of course one you're entirely within your rights to make, but not that the feature has a negative overall value. For the rest, it seems like you and I have different ideas about what the author meant that are going to be impossible to clear up without input from the author, so I will suggest that we drop that unless and until we do get such input.
- burntsushi 4y ago> Looking closer, GNU grep, git grep, ripgrep all support PCRE. That might be an okay alternative. It would take some time and effort to switch over. I do not know yet whether it would be worth the effort, but getting used to a different syntax that's used by a wide number of tools seems more useful than getting used to a different syntax that's used by a single tool, no matter how useful the tool. Yes, that's true. You could do that. I will say though that if you take PCRE, EREs and ripgrep's default regex engine, they all support largely the same syntax. There are differences of course (you've pointed out one already), but they're a lot more alike than they are different. BREs are the oddball with its escaping rules. But if you know the escaping rules they can be quite useful in a context where most of what you're searching for is a literal with some regex aspects. Vim's default regex syntax is like this for example and it is quite useful in that context. And yes, grep's tend to have a lot of extensions. So I guess what you're after is "GNU's particular extension of regex syntax." Idk, just seems like if that's what you care most about, then just keep using GNU tooling. Otherwise, ripgrep's default regex engine is very very similar to EREs and other Perl inspired regex syntaxes. Which is intentional. The \< and \> stuff might be something I implement eventually, but I've always found them strange. YMMV.