This channel is intended for users of App::Rak raku.land/zef:lizmat/App::Rak Set by lizmat on 27 September 2022. |
|||
04:02
[Coke]___ joined
04:05
[Coke] left
|
|||
Geth | App-Rak/main: 6b714d4a73 | (Elizabeth Mattijsen)++ | 8 files Allow URLs as file specification Also allow multiple ecosystems to be specified with --ecosystem |
10:39 | |
rak/main: 21cd3df75c | (Elizabeth Mattijsen)++ | 3 files 0.0.32 |
10:45 | ||
App-Rak/main: 10a3139922 | (Elizabeth Mattijsen)++ | xt/02-simple.rakutest Add tests for --sourcery, --ecosystem, URLs |
11:43 | ||
12:56
[Coke]___ is now known as [Coke]
|
|||
Geth | App-Rak/main: 6c9fdfa34b | (Elizabeth Mattijsen)++ | 6 files Add support for --description Allowing users to add a description to a custom option |
14:30 | |
18:02
Nemokosch joined
|
|||
Nemokosch | Hello hello | 18:21 | |
rak '{ .say if .comb(/ \d+ /).first(* ~~ (1 .. 65)) }' path_of_file.c | |||
do you know a significantly easier way to get the lines that contain a number between 1 and 65? maybe I'm just too much of a noob and overcomplicating things | 18:22 | ||
oh and found the answer to the other question, --no-group-matches can remove the separating lines between the groups of consecutive matches | 18:26 | ||
Noting another thing I'm gonna try to find out: "find all words longer than 31 characters in all files with a certain extension" | 18:28 | ||
18:28
Nemokosch left
18:36
Nemokosch joined
|
|||
Nemokosch | It turned out that I needed to rely on a naming convention rather than the extension and there is something I don't understand | 18:48 | |
rak '/ \w ** 32..* /' --file='/ "_config" $ /' src/param/ | 18:49 | ||
^ this seems to traverse the known universe; eventually it halted on an Excel file or something | 18:51 | ||
however | |||
rak '/ \w ** 32..* /' --file='* ~~ / "_config" $ /' src/param/ | |||
(I only added smartmatching to the whatever star) | 18:52 | ||
this works just as I wished | |||
is this intentional design or a bug? | |||
lizmat | If you want to limit to files with extension "foo", you can do --extensions=foo | 19:00 | |
[Coke] | did you mean _config and not a . ? | 19:02 | |
Nemokosch | yes, unfortunately the system wouldn't use extensions but mere naming conventions | 19:06 | |
blah_config | |||
[Coke] | ah | 19:07 | |
[Coke] plays with rak, finds Steams engish profanity filter which is a file with 69 lines of regular expressions. | 19:09 | ||
Nemokosch | HAhahaha | ||
[Coke] | (was looking for .gz files, not files with swears. :) | ||
lizmat | Nemokosch: re " "find all words longer than 31 characters in all files with a certain extension"" do you want to know just the words, or where they are in the files ? | 19:10 | |
Nemokosch | lizmat: it would be good to at least know the line number (but the whole line is not necessary) | 19:11 | |
actually even just the word can be fine but eventually I'd want to find them in the file | 19:12 | ||
lizmat | rak '/ \w ** 32..* /' --file='*.ends-with("_config")' | 19:15 | |
that should also highlight the words | |||
Nemokosch | nice :) | ||
re: which files to pick - the sad truth is that there isn't a simple and accurate way to determine which files are "this sort of config file" and which aren't. Another check I would be happy with: "select this file only if it contains a certain pattern" | 19:16 | ||
they tend to have a header with a certain description | |||
lizmat | is there a program that you could call to select? then you could use --exec | 19:17 | |
Nemokosch | --shell='grep -q "yadda yadda config" $_' is okay | ||
I'm just wondering if there isn't a more "native" way | 19:18 | ||
lizmat | well, you could always use a first call to determine the files, and then pipe that to the next rak with --files-from=- | ||
rak '/ initial selection /' --file='*.ends-with("_config")' --files-with-matches | rak --files-from=- '/ further selection /' | 19:20 | ||
Nemokosch | is that dash a shell feature or handwritten? | ||
lizmat | handwritten | ||
just following convention | |||
re incorrect config file types: would your search query produce false positives if inspecting the "wrong" config file ? | 19:23 | ||
Nemokosch | yes - but since there is no foolproof definition, I'd pick false positives over false negatives so that's acceptable | 19:24 | |
to make the story at least a bit vivid: the story is that a certain config utility in this project stored the keys in char[32], hence anything that is at least 32 characters will fail | 19:26 | ||
and it turned out that there were indeed some 32 long config key names | |||
lizmat | re: all lines with numbers between 1 and 65: | 19:31 | |
rak '/ \d+ <?{ 1 <= $/.Int <= 65 }> /' | |||
re false positives being ok: don't bother about the extension / looking at headers ? | 19:33 | ||
Nemokosch | okay... that would be a bit overboard | 19:37 | |
remember the Excel files? lol | 19:38 | ||
lizmat | well, if these config files share *some* kind of extension, then you could filter on that with --file | ||
Nemokosch | they share the extension of no extension, if that counts | 19:39 | |
at least I think so | |||
lizmat | --extensions=, | ||
would limit to files without extension | |||
Nemokosch: anything else I can help you with? | 19:52 | ||
Nemokosch: if you would have an option --accept='*.slurp.starts-with("foo")' the would be given an IO::Path object of the file being checked for inclusion | 20:08 | ||
that would sorta solve your problem, no? | |||
Nemokosch | yes, or at least it would provide quite a great variety of tools | 20:22 | |
anyway, thank you, I think as much as it could be investigated with simple CLI tools, we got it covered :) | 20:23 | ||
lizmat | --accept='*.slurp.contains("use Test") would accept files that have "use Test" in them | 20:46 | |
rak foo --accept='*.slurp.contains("use Test") | |||
would look for "foo" in files with "use Test" in them | |||
rak foo --deny='*.slurp.contains("use Test") | |||
would look for "foo" in files that do NOT have "use Test" in them | 20:47 | ||
anyways, glad rak was of help :-) | |||
(I hope :-) | 20:50 | ||
Geth | rak/main: 0561c4662b | (Elizabeth Mattijsen)++ | 6 files 0.0.33 |
21:16 | |
App-Rak/main: 10f84c38d4 | (Elizabeth Mattijsen)++ | 8 files Add support for --accept and --deny After discussing a use case on #raku-rak . Allows one to specify Raku code that will accept a file or deny a file from being further inspected. Also add some answers to some questions in the FAQ. Add default --file setting always, unless it is explicitely set, or set implicitely by another explicit option (such as --extensions). |
21:20 | ||
Nemokosch | Sure thing! Even if I can't completely ditch find, grep and similar *nix tools because non-modifiable legacy systems but it really plays well with the Raku-as-utility approach | 21:22 | |
lizmat | glad to hear! | ||
22:34
Nemokosch left
|