4 Nov 2024 |
lizmat |
I'll get back to it after I finished the Weekly |
14:12 |
|
|
ok? |
|
|
tbrowder |
you bet, thnx. i don't know how rak's guts work but maybe using a Nil positional could tell rak to skip file content analysis |
15:08 |
|
|
later... |
|
|
5 Nov 2024 |
SmokeMachine |
lizmat: is there a way to a query using :find to return the name of the file? it seems to be returning "<find>", and I don't know from where it's getting those line numbers... usercontent.irccloud-cdn.com/file/.../image.png |
11:41 |
|
|
(but I think it's .looking good... :) |
11:42 |
|
lizmat |
iirc :find should return the filenames as the result ? |
11:43 |
|
SmokeMachine |
I mean as $key when calling result... |
11:46 |
|
|
shouldn't it? |
|
|
lizmat |
I think the Callable is wrong |
11:49 |
|
|
it should be something like: { try { $_ if .slurp.AST... } }, ... |
|
|
SmokeMachine |
a simpler example: usercontent.irccloud-cdn.com/file/.../image.png |
11:54 |
|
lizmat |
the reason you get the contents, is because the callable returns the contents, instead of True or False |
11:56 |
|
SmokeMachine |
so I should return the IO? |
|
|
|
but is there a way to print the custom value and the filename? |
11:57 |
|
lizmat |
you determine that by what you return in the Callable |
12:00 |
|
|
could well be anything |
|
|
SmokeMachine |
I mean, on my case I'm searching for specific AST on many files of code, and I want to return the name of the files where that ast was found and the ast itself... |
|
|
lizmat |
so, why did you specify :find then ? |
|
|
SmokeMachine |
because otherwise my callable would receice each line, instead of the IO... |
12:01 |
|
lizmat |
and why not use the "rak" CLI ? |
|
|
|
aah... --per-file |
|
|
|
not sure what that is in the rak module |
|
|
|
the mapping of cli opts to args to the "rak" sub is not always 1 one 1 |
12:02 |
|
|
fwiw, it feels that your use of "rak" is a bit of overkill |
12:06 |
|
SmokeMachine |
and I'm not using the rak cli because it seems to not be importing the exports of modules (or I am doing something wrong) (github.com/lizmat/rak/issues/5) usercontent.irccloud-cdn.com/file/.../image.png |
|
|
lizmat |
feels to me raku.land/zef:lizmat/paths should be enough to make a file selection |
12:07 |
|
|
and then .IO.slurp do you thing on what that produces |
|
|
SmokeMachine |
I'll give a try on `path`, thanks! |
12:08 |
|
|
what about the --module? |
12:09 |
|
lizmat |
there's an issue for it... didn't get around to looking at that yet |
|
|
tbrowder |
ah, paths my be what i need, too! |
12:10 |
|
|
*may be |
|
|
SmokeMachine |
lizmat: thanks! |
|
|
|
lizmat: it seems `paths` is working well on my case, thanks! usercontent.irccloud-cdn.com/file/.../image.png |
12:18 |
|
lizmat |
paths(:file(*.ends-with(".rakumod")) would be faster :-) |
12:20 |
|
|
and then $file.IO.slurp |
|
|
|
prevents a lot of IO::Path objects from being made |
12:21 |
|
SmokeMachine |
working well, thanks! Now, my next step is to fix the array inside array on named results on ASTQuery, (not related to rak nor paths), thanks! usercontent.irccloud-cdn.com/file/.../image.png |
12:23 |
|
lizmat |
yw |
12:24 |
|
tbrowder |
lizmat: paths IS what i need, sorry for the bother, but it might be worth mention ing module "paths" in the rak docs. |
12:26 |
|
|
thank you very much! |
12:27 |
|
|
hm, how about pairing 'paths' with 'App::Rak' to get the equiv of Gnu find? |
17:43 |
|
|
maybe allow something like : $rak = rak {paths(@dirs)} , :named1, :etc; |
17:46 |
|
lizmat |
$ rak --find |
17:51 |
|
|
should already be very close to GU find in functionaliy ? |
|
|
|
$ rak foo --find |
17:52 |
|
|
will find all files with "foo" in their name |
|
|
tbrowder |
yes, i think i see how to use it as a CLI cmd. i’ll have to experiment some more, though. |
23:24 |
|
|
i’m working on a PR for rak doc tweaks to help us weaker-minded users apply it as simply as possible 😁 |
23:26 |
|
lizmat |
nice |
23:29 |
|
|
meanwhile I'm going for some shuteye & |
|
|
tbrowder |
nitey nite |
23:58 |
|