Using rtk 0.42.4 from Homebrew. rtk grep is one of the commands I use the most, but a couple of really common invocation shapes don't behave the way I'd expect.
-r (and -rn) get rejected outright
$ rtk grep -r "TODO" src
error: unexpected argument '-r' found
tip: to pass '-r' as a value, use '-- -r'
Usage: rtk grep [OPTIONS] <PATTERN> [PATH] [EXTRA_ARGS]...
-rn fails the same way. Since rtk grep is always recursive anyway, I'd expect -r/--recursive to just be accepted and ignored, the same way -n/--line-numbers already is (there's even a comment in the code to that effect). Instead it falls all the way back to running plain grep completely unfiltered — which kind of defeats the point of using rtk in the first place, since -r/-rn is probably the single most common way people actually type a recursive grep.
I checked whether this was already fixed in develop before reporting — built it from source, and -r/-rn do work there now (looks like it happened as a side effect of restructuring the arg parsing, not sure if intentional). So this might just need backporting/releasing rather than a new fix.
-rln on develop: silent false "0 matches"
While checking the above, I found -rln still misbehaves on develop, just differently:
$ rtk grep -rln "TODO" src
0 matches in 0 files
There are definitely matches there (plain grep confirms it). Dug a bit further — looks like the combined short flags get merged into one token (e.g. -rln → -ln after the recursive flag is stripped), and the check for "format" flags like -l (files-with-matches) only looks for it as a standalone arg, not bundled inside a cluster like that. So rtk doesn't realize -l changed rg's output shape entirely, tries to parse it as normal match lines, and silently gets nothing — which looks exactly like "no matches found" instead of "something's off here."
I have a small fix for the second one and will open a PR. Mentioning both here since they're related (same command, same general area) and the first one might just need a release rather than code changes.
Using rtk 0.42.4 from Homebrew.
rtk grepis one of the commands I use the most, but a couple of really common invocation shapes don't behave the way I'd expect.-r(and-rn) get rejected outright-rnfails the same way. Sincertk grepis always recursive anyway, I'd expect-r/--recursiveto just be accepted and ignored, the same way-n/--line-numbersalready is (there's even a comment in the code to that effect). Instead it falls all the way back to running plain grep completely unfiltered — which kind of defeats the point of using rtk in the first place, since-r/-rnis probably the single most common way people actually type a recursive grep.I checked whether this was already fixed in
developbefore reporting — built it from source, and-r/-rndo work there now (looks like it happened as a side effect of restructuring the arg parsing, not sure if intentional). So this might just need backporting/releasing rather than a new fix.-rlnon develop: silent false "0 matches"While checking the above, I found
-rlnstill misbehaves on develop, just differently:There are definitely matches there (plain grep confirms it). Dug a bit further — looks like the combined short flags get merged into one token (e.g.
-rln→-lnafter the recursive flag is stripped), and the check for "format" flags like-l(files-with-matches) only looks for it as a standalone arg, not bundled inside a cluster like that. So rtk doesn't realize-lchanged rg's output shape entirely, tries to parse it as normal match lines, and silently gets nothing — which looks exactly like "no matches found" instead of "something's off here."I have a small fix for the second one and will open a PR. Mentioning both here since they're related (same command, same general area) and the first one might just need a release rather than code changes.