├── .github ├── FUNDING.yml └── workflows │ ├── linux.yml │ ├── macos.yml │ └── windows.yml ├── .gitignore ├── Changes ├── LICENSE ├── META6.json ├── README.md ├── TODO ├── _config.yml ├── bin └── rak ├── csv ├── comma.csv ├── noheader.csv └── semicolon.csv ├── dist.ini ├── doc └── App-Rak.rakudoc ├── lib └── App │ └── Rak.rakumod ├── mbc └── eigenstates.mbc ├── patterns ├── pdf └── basic.pdf ├── q ├── eight ├── five ├── foo ├── four ├── nine ├── one ├── seven ├── six ├── three ├── two └── zero ├── resources ├── help.txt └── help │ ├── argument.txt │ ├── code.txt │ ├── content.txt │ ├── debugging.txt │ ├── examples.txt │ ├── faq.txt │ ├── filesystem.txt │ ├── general.txt │ ├── haystack.txt │ ├── item.txt │ ├── listing.txt │ ├── option.txt │ ├── pattern.txt │ ├── philosophy.txt │ ├── resource.txt │ ├── result.txt │ ├── special.txt │ └── string.txt ├── run-tests ├── t └── 01-basic.rakutest ├── tools └── makeOPTIONS.raku └── xt ├── 01-simple.rakutest ├── 02-csv.rakutest ├── 03-json.rakutest ├── 04-pdf.rakutest ├── 05-mbc.rakutest └── coverage.rakutest /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | lizmat: 2 | -------------------------------------------------------------------------------- /.github/workflows/linux.yml: -------------------------------------------------------------------------------- 1 | name: Linux 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | tags-ignore: 8 | - '*' 9 | pull_request: 10 | 11 | jobs: 12 | raku: 13 | strategy: 14 | matrix: 15 | os: 16 | - ubuntu-latest 17 | raku-version: 18 | - 'latest' 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: Raku/setup-raku@v1 23 | with: 24 | raku-version: ${{ matrix.raku-version }} 25 | - name: Install Dependencies 26 | run: zef install --/test --test-depends --deps-only . 27 | - name: Run Special Tests 28 | run: raku run-tests -i 29 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: MacOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | tags-ignore: 8 | - '*' 9 | pull_request: 10 | 11 | jobs: 12 | raku: 13 | strategy: 14 | matrix: 15 | os: 16 | - macos-latest 17 | raku-version: 18 | - 'latest' 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: Raku/setup-raku@v1 23 | with: 24 | raku-version: ${{ matrix.raku-version }} 25 | - name: Install Dependencies 26 | run: zef install --/test --test-depends --deps-only . 27 | - name: Run Special Tests 28 | run: raku run-tests -i 29 | -------------------------------------------------------------------------------- /.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | tags-ignore: 8 | - '*' 9 | pull_request: 10 | 11 | jobs: 12 | raku: 13 | strategy: 14 | matrix: 15 | os: 16 | - windows-latest 17 | raku-version: 18 | - 'latest' 19 | runs-on: ${{ matrix.os }} 20 | 21 | env: 22 | # Workaround for path length errors during precompilation of longer repo names 23 | TMPDIR: /tmp 24 | 25 | steps: 26 | - uses: actions/checkout@v4 27 | - uses: Raku/setup-raku@v1 28 | with: 29 | raku-version: ${{ matrix.raku-version }} 30 | 31 | - name: Ensure TMPDIR exists 32 | run: mkdir -p ${{ env.TMPDIR }} 33 | - name: Install JSON::Fast 34 | run: zef install JSON::Fast --/test 35 | - name: Install Dependencies 36 | run: zef install --/test --test-depends --deps-only . 37 | - name: Run Special Tests 38 | run: raku run-tests -i 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .precomp/ 2 | /App-Rack-* 3 | /releases/ 4 | *.rakucov 5 | 1 6 | 2 7 | HN 8 | -------------------------------------------------------------------------------- /Changes: -------------------------------------------------------------------------------- 1 | Revision history for App-Rak 2 | 3 | {{$NEXT}} 4 | 5 | 0.3.19 2025-02-12T17:08:38+01:00 6 | - Bump dependency on rak to get rid of implicit ParaSeq 7 | dependency, as that is apparently not ready for prime time 8 | - Actually activate --rakudo-c option 9 | 10 | 0.3.18 2025-02-11T21:51:46+01:00 11 | - Added support for options: --rakudo-all, --rakudo-c, 12 | --rakudo-doc, --rakudo-java, --rakudo-js, --rakudo-nqp, 13 | --rakudo-perl, --rakudo-raku, --rakudo-shell, 14 | -- rakudo-test, --rakudo-yaml 15 | - Bump dependencies, because we can 16 | 17 | 0.3.17 2025-02-08T19:36:55+01:00 18 | - Add support for --eco-doc option 19 | - Rename --eco-all option to --eco-code 20 | - Rename --ecosystem option to --eco-meta 21 | - Fix thinko with --eco-code option 22 | - Fix output of --eco-xxx in conjunction with 23 | --files-with(out)-matches 24 | 25 | 0.3.16 2025-02-07T11:39:45+01:00 26 | - Rename option --code-from to --eco-all 27 | - Rename option --provides-from to --eco-provides 28 | - Rename option --scripts-from to --eco-scripts 29 | - Rename option --tests-from to --eco-tests 30 | - Added support for --no-modifications 31 | 32 | 0.3.14 2025-02-06T21:04:37+01:00 33 | - Add support for --code-from, --provides-from, 34 | --scripts-from and --tests-from arguments 35 | - Update copyright year 36 | 37 | 0.3.13 2024-08-21T21:12:20+02:00 38 | - Remove unnecessary hypering from --unicode 39 | - Bump "Needle::Compile" to get several regex / $/ fixes 40 | - Bump "rak" to get several ParaSeq fixes 41 | 42 | 0.3.12 2024-08-20T16:21:00+02:00 43 | - Make --modify-files present the target without line endings 44 | by default. Specify --with-line-endings if you want them 45 | included 46 | 47 | 0.3.11 2024-08-19T21:37:28+02:00 48 | - Bump "rak" to get ParaSeq's exception handling fix 49 | 50 | 0.3.10 2024-08-19T16:01:23+02:00 51 | - Make --per-paragraph and --modify-files work properly 52 | without eating whitespace between paragraphs 53 | - Bump dependency on String::Utils to get "paragraphs" fix 54 | 55 | 0.3.9 2024-08-19T12:14:12+02:00 56 | - Add support for --also-first to produce the first N lines 57 | if there is a match 58 | - Add support for --always-first to always produce the first 59 | N lines, regardless of whether there is a match or not 60 | - Bump dependency on "rak" to get ":also-first" and 61 | ":always-first" support 62 | 63 | 0.3.8 2024-08-18T21:09:44+02:00 64 | - Unbreak the --edit-files option: this probably got borked 65 | in 0.3.4 . This feature *is* hard to test! 66 | 67 | 0.3.7 2024-08-18T14:59:31+02:00 68 | - Allow --count-only and --unique to be used simultaneously 69 | 70 | 0.3.6 2024-08-18T12:40:54+02:00 71 | - Add support for --per-paragraph to produce haystacks 72 | per paragraph, rather than by line or the whole file 73 | - Bump dependency on String::Utils to get "paragraphs" 74 | with :Pair named argument 75 | - Bump dependency on rak to get ":produce-many-pairs" 76 | functionality 77 | 78 | 0.3.5 2024-08-17T19:49:18+02:00 79 | - Separate "producer" logic from "action" logic, to allow 80 | e.g. --per-file and --modify-files to be combined 81 | - Fix issue with highlighting if :smartmark or :smartcase 82 | were specified, and the needle didn't match exactly 83 | - Up dependency on "highlighter" to get proper :smartcase 84 | and :smartmark support 85 | 86 | 0.3.4 2024-08-16T20:30:55+02:00 87 | - Complete migration to Needle::Compile, which introduces a 88 | number of new features, such as "!", "&", "s:" pattern 89 | prefixes, and the --not, --and, --andnot, --or, --ornot 90 | arguments 91 | - Remove dependency on "has-word", that logic is now handled 92 | inside Needle::Compile 93 | - BREAKING CHANGE: using jp() inside code needles now require 94 | the expression to be quoted, just as if it is a normal 95 | subroutine call. The special handling of transparently 96 | convering "jp(foo)" to "jp('foo')" was brittle and too much 97 | magic. The jp() function is now a normal, callable sub 98 | like any other 99 | 100 | 0.3.3 2024-08-04T17:40:00+02:00 101 | - Added support for --ack to activate a compatibility 102 | layer for former "ack" users. 103 | - Added dependency on Needle::Compile to handle all the 104 | pattern to Callable issues (just for CI for now) 105 | - Upped all dependencies where applicable 106 | - Hoperfully fixed Windows CI for now 107 | 108 | 0.3.2 2024-07-29T13:54:14+02:00 109 | - Give each CSV file its own Text::CSV object, in the hope 110 | that this will fix the race-condition that 0racle++ spotted 111 | 112 | 0.3.1 2024-07-29T13:03:48+02:00 113 | - Upped dependency on "rak" to get PairChanged support 114 | - Allow *.subst("foo","bar") to be used with --modify-files 115 | *and* have statistics be properly updated. finanalyst++ 116 | for the bug report 117 | 118 | 0.3.0 2024-07-28T20:10:47+02:00 119 | - Upped dependency on "rak" which uses "ParaSeq" for 120 | better asynchronous performance. 121 | - Add separate CI badges for each OS 122 | - Add sponsor button 123 | 124 | 0.2.26 2024-05-14T19:25:29+02:00 125 | - Upped dependency on "rak" for fix on hyperizing 2MB+ 126 | text files 127 | - Adapt "only first xx matches shown" message depending on 128 | whether they were actually shown, or written to a file or 129 | pipe 130 | 131 | 0.2.25 2024-05-14T12:47:25+02:00 132 | - Ignore --progress if STDERR is not a tty. This allows 133 | --progress to be used as a default 134 | - Ignore --progress with --edit option, as the editing can 135 | actually be part of the lazy searching, and you don't 136 | want the announcer running while editing a file 137 | - Document the --encoding option 138 | - Upped dependency on "rak" for hyperizing 2MB+ text files 139 | 140 | 0.2.24 2024-05-13T15:50:05+02:00 141 | - Allow --edit to work with --files-with-matches and 142 | --files-without-matches 143 | - Add support for --mbc option to allow searches on the 144 | structure of a MoarVM bytecode file 145 | - Upped dependency on "rak" to follow renaming of the 146 | ":sort" argument to ":sort-sources", for ":progress" 147 | support and several race condition fixes and general 148 | improvements 149 | - Alert to possible erroneous path specification if not 150 | a single source file was found 151 | - Add support for --progress option, writing search result 152 | progress to STDERR 153 | - The --unique option will now sort the result using 154 | foldcase logic 155 | - Update help on --only-first: the default is 1000, not 1 156 | - Stats output is now done on STDERR instead of STDOUT, 157 | as it's not really part of the result 158 | - Update copyright year 159 | 160 | 0.2.23 2024-05-09T13:51:24+02:00 161 | - Upped dependency on "rak" to fix issue with readability of 162 | files and --is-text, --is-moarvm and --is-pdf options 163 | 164 | 0.2.22 2024-05-08T22:15:02+02:00 165 | - Upped dependency on "rak" to fix issue with --is-moarvm 166 | - Add support for --mbc-frames and --mbc-strings options to 167 | allow searches in MoarVM bytecode files 168 | - Add tests for --pdf-xxx options 169 | 170 | 0.2.21 2024-05-08T15:44:12+02:00 171 | - Upped dependency on "rak" 172 | - Fix --paths argument: can now specify multiple paths 173 | separated by comma as per documentation 174 | - Add support for --is-moarvm to only select MoarVM 175 | bytecode files 176 | - Add support for --is-pdf to only select PDF files 177 | - Add support for --pdf-per-line and --pdf-per-file to 178 | search text contents of PDF files 179 | - Add support for --pdf-info to search meta-information 180 | of PDF files 181 | 182 | 0.2.20 2023-07-31T00:45:03+02:00 183 | - Fix dependency in code (as in the META) 184 | 185 | 0.2.19 2023-07-30T21:46:06+02:00 186 | - Add support for Wolfram Language / R extensions, antononcube++ 187 | - Made dependency on String::Utils a bit more lenient 188 | 189 | 0.2.18 2023-06-01T12:40:29+02:00 190 | - Upped some dependencies 191 | - Changed rakudoc a bit to use more =tables 192 | 193 | 0.2.17 2023-01-17T17:52:09+01:00 194 | - Allow postcircumfix [] on strings to index into the .words of 195 | the string. This looks like it is the most useful functionality 196 | within the context of Raku code patterns 197 | - Default to *not* showing line numbers when reading from STDIN. 198 | Feels to me that is the most sane thing to do 199 | - Update copyright year 200 | - Default to --/is-text with --find, Márton Polgár++ 201 | 202 | 0.2.16 2022-12-01T22:15:50+01:00 203 | - Turn the jp() specification inside a code pattern into a 204 | macro as it were, removing the need to specify quotes. So 205 | { ~jp("auth") } should now be specified as { ~jp(auth) } 206 | - Allow more than one call to the jp() macro in a code pattern, 207 | allowing for things like {~jp(name) if jp(auth) eq "zef:lizmat"} 208 | as a pattern 209 | 210 | 0.2.15 2022-11-30T12:51:22+01:00 211 | - A pattern must be specified at least. If a search without 212 | pattern is needed, one can use --pattern= 213 | - Make sure compilation on older Rakudos doesn't break because 214 | of lack of NYI subroutine 215 | 216 | 0.2.14 2022-11-24T22:31:37+01:00 217 | - Fix some verbosity when reading from STDIN 218 | - Merge consecutive regexes in multi-part needle into a 219 | single regex 220 | 221 | 0.2.13 2022-11-23T22:43:08+01:00 222 | - Introduce the $*_ dynamic variable inside { } patterns 223 | - Add --type=json-path for JSON path support 224 | - Add jp: in a pattern as shortcut for JSON path support 225 | 226 | 0.2.12 2022-11-23T13:07:47+01:00 227 | - Bump dependency on rak properly 228 | 229 | 0.2.11 2022-11-23T12:56:41+01:00 230 | - Make --unicode option about 2x as fast with hypering 231 | - Add .ipynb as additional extension in the #python group 232 | - Add * as a way to indicate all known --extensions 233 | - Remove --known-extensions in favour of --extensions=* 234 | - Bump dependency on rak to sync up path-utils/Git::Files 235 | 236 | 0.2.10 2022-11-19T20:01:25+01:00 237 | - Bump dependency on "rak" to get readability fixes 238 | 239 | 0.2.9 2022-11-18T17:34:39+01:00 240 | - Bump dependency on "rak" to get --files|paths-from=- fix 241 | - Can not use --paths=- to read paths from STDIN, please use 242 | --paths-from=- instead 243 | 244 | 0.2.8 2022-11-18T13:33:16+01:00 245 | - Bump dependency on "rak" to get IO hiding fix for data fetched 246 | from URLs. 247 | - Fix issue with --find --/human spotted by Márton Polgár 248 | - Make sure that --help=section will also run through any pager 249 | 250 | 0.2.7 2022-11-16T13:12:17+01:00 251 | - Add support for --headers argument, which is a sub-option of 252 | --csv-per-line, which now will assume a header line in the 253 | CSV file per default, and will produce hashes per line, keyed 254 | to the column name. 255 | - Added some basic --csv-per-line author tests 256 | - Fix issue with --type= information not being authoritative, 257 | spotted by Márton Polgár 258 | 259 | 0.2.6 2022-11-14T18:15:53+01:00 260 | - Bump dependency on rak to get "is-text" support 261 | - Add "is-text" option to indicate selecting files with text 262 | rather than with binary data. Made that also the default 263 | rather than --known-extensions. Can specify --/is-text to 264 | select files with binary data, but that only makes sense 265 | when --find is also specified for now. Refuse to search 266 | binary files otherwise (at least for now). 267 | 268 | 0.2.5 2022-11-11T19:04:06+01:00 269 | - Fix issue with pager setting being ignored in some (obvious) 270 | cases 271 | - Ensure that "less" and "more" are called raw by default, to 272 | make sure highlighting is shown properly 273 | - Bump dependency on rak to get directory only search support 274 | - Allow --/file --find to just search paths of directories 275 | 276 | 0.2.4 2022-11-10T14:01:43+01:00 277 | - Fix issue with bare literal * being interpreted as a 278 | Whatever, rather than as a literal '*' 279 | - Fix issue with --backtrace without file containing backtrace 280 | - Bump dependency on rak to auto-skip binary files without 281 | extension 282 | - Add dependency on Backtrace::Files 283 | - Add support for --execute-raku 284 | - Add #js group of extensions, add .css to #html group 285 | 286 | 0.2.3 2022-11-05T11:56:14+01:00 287 | - Up dependency on String::Utils to get "has-marks" support 288 | - Add support for --smartmark 289 | - Fix issue with --edit --find 290 | 291 | 0.2.2 2022-11-02T13:11:04+01:00 292 | - Change default for --proximate to off always, instead of 1 293 | when --human is (implicitly) specified 294 | - Fix issue with regex patterns in --patterns-from, spotted by 295 | Zer0-Tolerance++ 296 | - Documentation tweaks 297 | 298 | 0.2.1 2022-10-30T12:50:04+01:00 299 | - Add support for --type=equal 300 | - Add support for ^string as a shortcut for --type=starts-with 301 | - Add support for string$ as a shortcut for --type=ends-with 302 | - Add support for ^string$ as a shortcut for --type=equal 303 | - Add support for §string as a shortcut for --type=words 304 | - Bump dependency on highlighter to get support for "equal" and 305 | the Type role for annotating strings with a type of search 306 | - Rewrote the "pattern" section in the documentation, to give 307 | a better overview from the start 308 | 309 | 0.2 2022-10-28T13:38:31+02:00 310 | - Add support for --patterns-from 311 | - Add support for --type=auto|regex|code, make --type leading 312 | - Fixed a (implicit) --smartcase blocking use of --unicode 313 | - Bumped dependency on highlighter to get multiple needle support 314 | - Fix issue with handling unknown extension groups, Mustafa Aydın++ 315 | 316 | 0.1.12 2022-10-22T13:04:37+02:00 317 | - Add dependency on IO::Path::AutoDecompress to make 318 | --auto-decompress option an option that is always available 319 | - Bump dependency on String::Utils to get "non-word" 320 | - Make regexes that consist of a literal string of word characters 321 | only, use the much faster .contains logic on the literal string, 322 | rather than going the full regex way 323 | 324 | 0.1.11 2022-10-20T16:01:39+02:00 325 | - Add support for --auto-decompress 326 | - Bump dependency on rak to get :ioify functionality 327 | 328 | 0.1.10 2022-10-19T13:10:02+02:00 329 | - Introduce $*N dynamic variable to the pattern of --rename-files 330 | and --modify-files. 331 | - Make --modify-files repeatable by sorting the paths 332 | - (Implicitely) specifying --smartcase in situations where it does 333 | not make sense, is now silently ignored, just like --ignorecase 334 | and --ignoremark 335 | - Fix issue in loading of "sourcery" check 336 | - Fix issue with divider in --help search results 337 | - Fix issue with searching as if --find-all was active by default 338 | 339 | 0.1.9 2022-10-16T14:40:53+02:00 340 | - Bump dependency on rak to get :sort functionality 341 | - Make --rename-files repeatable by sorting the paths 342 | - Fix spello in --dryrun in runtime documentation 343 | 344 | 0.1.8 2022-10-15T21:39:16+02:00 345 | - Bump dependency on rak to fix issue with testing that would 346 | inhibit installing App::Rak 347 | 348 | 0.1.7 2022-10-15T16:03:10+02:00 349 | - Refurbish the --help functionality by allowing it to search 350 | help subjects. 351 | - Remove dependency on CLI::Help, it is no longer convenient to 352 | use for rak 353 | 354 | 0.1.6 2022-10-14T22:40:31+02:00 355 | - Fixed various issues with saving custom options, specifically: 356 | - not saving some flags 357 | - not being able to indicate a required value (aka --foo=!) 358 | - not being able to indicate a default value (aka --foo=[bar]) 359 | - Allow ∞, * and Inf with --only-first to indicate all possible 360 | results 361 | - Fix issue with showing description on non-flag options 362 | - Use RAK_CONFIG= to not load any custom options (including defaults) 363 | 364 | 0.1.5 2022-10-13T17:12:00+02:00 365 | - Bump dependency on as-cli-arguments for better quoting rules 366 | - Fix issue with message when removing a custom option 367 | - Show single letter custom options with a single dash 368 | - Allow for saving default options to be activated on each run 369 | - Introduce RAK_CONFIG environment variable for location of custom 370 | options 371 | - Added documentation section "On the interpretation of options" 372 | - Expanded documentation section "Creating your own options" 373 | 374 | 0.1.4 2022-10-12T14:55:51+02:00 375 | - Add support for --output-dir 376 | - Bump dependency on rak get some fixes 377 | - Fix two cases of unexpected leftovers 378 | 379 | 0.1.3 2022-10-11T15:46:55+02:00 380 | - Bump dependency on String::Utils to get support for ngram 381 | - Bump dependency on rak to get :classify and :categorize support 382 | - Add support for --classify and --categorize 383 | 384 | 0.1.2 2022-10-08T23:57:41+02:00 385 | - Bump dependency on rak to get URL support as file specification, 386 | and support for --accept and --deny 387 | - Allow for multiple ecosystem specs with --ecosystem 388 | - Add support for --description 389 | 390 | 0.1.1 2022-10-06T14:35:22+02:00 391 | - Add support for --sourcery 392 | - Add support for --ecosystem 393 | - Fix issue with --list-custom-options 394 | - Fix issue with some custom options being saved incorrectly 395 | - Allow for negation of custom options that were saved as False 396 | - Bump dependency on rak to have --find not be eagerized. 397 | Unfortunately, this still doesn't solve the issue of the 398 | iterator being held up somewhere / somehow until all values 399 | have been produced 400 | 401 | 0.1 2022-10-02T20:04:39+02:00 402 | - The first official beta-version of App::Rak. With fleshed 403 | out documentation for all arguments from the command line 404 | - Bump dependency on rak to get default for :dir/:file fix 405 | and non-eagerizing when reading from STDIN 406 | - Make sure --find-all is actually handled 407 | - Support --per-line also with a Callable producer 408 | - Properly stringify any Buf returned by a matcher as a list 409 | of integers 410 | - Rename --show-line-number to --show-item-number to make it 411 | more in line with the concept of producers producing items 412 | - Make dependency on Edit::Files optional 413 | - Fix issue with --modify-files losing line-endings 414 | - --edit and --find can now be used together again 415 | - Allow a Callable to be specified with --degree 416 | - Bump dependency on highlighter to fix --matches-only behaviour 417 | 418 | 0.0.99 2022-09-27T22:12:15+02:00 419 | - Add support for --unicode 420 | - Workaround Raku issue with coercion to Str with highlighting 421 | - Fix issue with non-matching incomplete flags, such as --tri 422 | - Make non-empty Slip return values from Callables DTRT 423 | - Add documentation on possible return values of Callable patterns 424 | - Bump dependency on rak for deadlock issues caused by Git::Files 425 | - Fix issue with --blame-per-file not honoring e.g. --unique 426 | - Fix issue with --blame-per-line not honoring e.g. --unique 427 | - Fix issue with --json-per-file not honoring e.g. --unique 428 | - Fix issue with --json-per-line not honoring e.g. --unique 429 | - Fix issue with --json-per-elem not honoring e.g. --unique 430 | 431 | 0.0.98 2022-09-26T19:49:26+02:00 432 | - Bump dependency on rak to get :old-new support 433 | - Bump dependency on CLI::Help for unknown category fix 434 | - Add support for --rename-files 435 | - Add support for --absolute 436 | 437 | 0.0.97 2022-09-24T20:30:23+02:00 438 | - Add extensions groups for #cro and #html 439 | - Bump dependency on rak for various fixes 440 | - Bump dependency on String::Utils to get selective importing 441 | - Bump dependency on as-cli-arguments to get Pair support 442 | - Complete rewrite of argument handling. Instead of feeding the 443 | command line arguments into Capture to call MAIN with, process 444 | all command line arguments in order and group them into areas 445 | of interest / appropriate actions. This reduces the number of 446 | checks that need to be made to figure out what to do, and makes 447 | it possible to produce better error reports with regards to the 448 | options specified on the command line. 449 | - Add support for --proximate 450 | - Add support for --human back in 451 | - Add support for --json-per-elem 452 | - Add support for --dont-catch 453 | - Change dependency from JSON::Fast to JSON::Fast::Hyper to allow 454 | for hypering --json-per-elem 455 | - Fix issue with using a regex and --edit 456 | - Bump dependency on META::constants for more resiliency 457 | - Bump dependency on CLI::Version for more resiliency 458 | - Document the --exec and --shell options 459 | - Document --only-first properly (instead of as --first-only) 460 | 461 | 0.0.96 2022-09-12T12:07:41+02:00 462 | - Fix snafu with argument parsing rework bleeding into the 463 | distribution 464 | 465 | 0.0.95 2022-09-11T22:47:42+02:00 466 | - Fix issue with specifying --extensions, finanalyst++ for spotting 467 | - Bump dependency on rak for :eager support 468 | 469 | 0.0.94 2022-09-04T23:26:02+02:00 470 | - Fix issue with error reporting of unknown options 471 | - Fix issue with reading from STDIN 472 | - Fix issue with codification of extensions to allow 473 | - Fix issue with --show-blame 474 | - Bump dependency on rak for various fixes 475 | 476 | 0.0.93 2022-09-04T13:45:08+02:00 477 | - Improve usability of the --accessed, --created, --modified 478 | and --meta-modified options so that comparisons are done using 479 | epoch values, and there's an easy way to indicate a moment in 480 | the past to compare against. Included extensive documentation 481 | for these features 482 | - Bump dependency on rak for :exec and :shell functionality 483 | - Add support for --exec and --shell functionality 484 | - Fix issue with --checkout having leftovers 485 | - Fix issue with multiple alternatives but with an exact match 486 | 487 | 0.0.92 2022-09-02T14:44:38+02:00 488 | - Add --max-matches-per-file option 489 | - Add --accessed, --created, --meta-modified, --modified options 490 | - Add better error handling, including "Did you mean" 491 | 492 | 0.0.91 2022-08-31T12:14:16+02:00 493 | - Make --find / --edit combination work 494 | - Document / Refine the --rak debugging option 495 | - Add --paths option, for specifying paths as named argument 496 | - Bump dependency on "rak" to get uvc fix 497 | - Hopefully workaround spesh issue causing execution errors 498 | 499 | 0.0.90 2022-08-30T23:53:04+02:00 500 | - A complete rework of the internals. Instead of having its own 501 | internal engine, now depends on the new "rak" module for the 502 | plumbing. 503 | - All of the options of earlier versions should still work, albeit 504 | with maybe a changed name, or slightly different (better) semantics. 505 | - Many, many new options available, most notably: 506 | - many options for selecting files from path properties 507 | - support for CSV files, based on Text::CSV 508 | - can now look into whole file if necessary, rather than by line 509 | - integrated statistics and frequencies options 510 | - git checkout on partial names 511 | - made some external dependencies optional 512 | - This now starts the path to version 0.1, the first official beta 513 | release. 514 | 515 | 0.0.47 2022-08-09T12:59:56+02:00 516 | - Make sure you can specify a ~/file with --files-from and 517 | --paths-from 518 | 519 | 0.0.46 2022-08-09T12:04:24+02:00 520 | - Allow for ~ to indicate home directory with specifications in 521 | --paths-from and --files-from. SmokeMachine++ for the suggestion 522 | 523 | 0.0.45 2022-08-07T23:09:01+02:00 524 | - Make "jsonl" default extension with --json-per-line 525 | - Bump dependency on Git::Blame::File to get shortened sha support 526 | - Add --unique option to only show unique produced lines 527 | - Add --list-known-extensions option as an informational aid 528 | - Fleshed out the help/input section a bit 529 | - Bumped dependency on CLI::Version to be more lenient with error 530 | checking 531 | 532 | 0.0.44 2022-08-07T13:50:07+02:00 533 | - Fix issue with just --quietly 534 | - Make "json" default extension with --json-per-file 535 | - Fix "useless use" warning with some cases of WhateverCode as pattern 536 | - Make legit warnings from processing Callable needles lose their 537 | location in code, as it serves no purpose and is only noise 538 | - Bumped dependency on CLI::Help to get better handling of --help foo 539 | - Mention --help when complaining about unexpected options 540 | - Make extension checks always lowercase 541 | 542 | 0.0.43 2022-08-06T23:59:18+02:00 543 | - Make --ignorecase, --ignoremark, --smartcase also work on regular 544 | expressions (by inserting :i / :m into the regex before EVALling) 545 | 546 | 0.0.42 2022-08-06T16:36:52+02:00 547 | - Fix issue with --count-only 548 | - Use --verbose instead of --files-with-matches with --count-only 549 | - Direct filename specification bypasses extension checks 550 | - Fix some pod issues, Anton Antonov++ 551 | 552 | 0.0.41 2022-08-06T14:22:07+02:00 553 | - Add --quietly to stop warnings in Callable needle execution. 554 | For now only in those options that require code needles 555 | - Add dependency on Trap for --silently support 556 | - Add --silently to stop any output in Callable needle execution. 557 | For now only in those options that require code needles 558 | 559 | 0.0.40 2022-08-05T17:12:19+02:00 560 | - Add dependency on String::Utils, for "is-sha1" and "before" 561 | - Skip filenames that are SHA1's (aka precompiled source) by default 562 | - Make sure you can call "rak" with a Callable as a needle 563 | 564 | 0.0.39 2022-08-05T10:54:49+02:00 565 | - Bump dependency on Git::Blame::File because then it will install 566 | - Unexpected Boolean options that are False are now acceptable 567 | - Die instead of exit if called as "rak" 568 | 569 | 0.0.38 2022-08-04T15:28:49+02:00 570 | - Bump dependency on CLI::Version to get more leniency 571 | - Export "rak" subroutine by default, adapt bin/rak accordingly 572 | 573 | 0.0.37 2022-08-04T00:18:12+02:00 574 | - Bump dependency on Git::Blame::File to get Failure fix 575 | 576 | 0.0.36 2022-08-03T22:54:58+02:00 577 | - Bump dependency on CLI::Version 578 | - Bump dependency on Files::Containing to fix searching with Callable 579 | - Add .ini extension in the #config group 580 | - Make --known-extensions default for human users 581 | 582 | 0.0.35 2022-07-31T22:21:23+02:00 583 | - Bump dependency on Files::Containing to get $*IO support and 584 | support for running FIRST / NEXT / LAST phasers 585 | - Add support for $*IO in Callable needles 586 | - Fix various small bugs 587 | 588 | 0.0.34 2022-07-30T12:35:53+02:00 589 | - Split off documentation into separate .rakudoc file 590 | - Added .rakudoc and .pod6 to the raku extensions list 591 | - Added support for FIRST, NEXT and LAST phasers if the needle 592 | is a Callable 593 | - Changed description to be more descriptive 594 | - Some more pod cleanup 595 | 596 | 0.0.33 2022-07-29T21:33:26+02:00 597 | - Fix issue with multiple matches inside the same paragraph with 598 | --paragraph-context 599 | - Fix issue with #raku, #text and #perl extension groups 600 | 601 | 0.0.32 2022-07-29T17:23:05+02:00 602 | - Add "paragraph-context" option to show paragraph around match, 603 | Eric de Hont++ for the suggestion 604 | 605 | 0.0.31 2022-07-28T23:46:56+02:00 606 | - Bump dependency on Git::Blame::File to get latest fixes 607 | - Add -blame-per-line option to filter on `git blame` objects 608 | 609 | 0.0.30 2022-07-28T14:02:10+02:00 610 | - Add dependency on Git::Blame::File 611 | - Add --show-blame option to show `git blame` output if possible 612 | 613 | 0.0.29 2022-07-28T00:19:30+02:00 614 | - Fix off-by-one in line number in --vimgrep output, Damian++ 615 | 616 | 0.0.28 2022-07-26T14:14:02+02:00 617 | - Add --smartcase option like --ignorecase without uppercase 618 | - Add --vimgrep option for integration into the :grep feature of vim 619 | - Made "Creating your own options" documentation more prominent 620 | 621 | 0.0.27 2022-07-25T22:12:00+02:00 622 | - Add --known-extensions to allow only known extensions 623 | - Add --passthru option to allow only highlighting 624 | - Add --pager option to page through output 625 | - Add support for #python, #ruby, #markdown, #text extensions 626 | 627 | 0.0.26 2022-07-24T23:53:03+02:00 628 | - Add --list-expanded-options option for debugging 629 | - Add --extensions option to specify extensions to look for 630 | 631 | 0.0.25 2022-07-24T17:53:12+02:00 632 | - Add --paths-from option to read paths from a file 633 | - Add --files-from option to read filenames from a file 634 | 635 | 0.0.24 2022-07-24T16:44:28+02:00 636 | - Add --find option to interprete selected paths as lines 637 | - Add -json-per-file option when reading from STDIN 638 | - Fix handling of "-" as a positional parameter 639 | - Fix handling of STDIN if a human is typing 640 | - Bump dependency of "as-cli-arguments" for fixes 641 | 642 | 0.0.23 2022-07-23T22:17:46+02:00 643 | - Bump dependency on Files::Containing to get "has-word" 644 | - First working version of reading lines from STDIN 645 | 646 | 0.0.22 2022-07-22T17:13:41+02:00 647 | - Make --json-per-line actually work 648 | - Add "count-only" support to json-per-line 649 | - Bump dependency on CLI::Help to inhibit -h from triggering 650 | - Bump dependency on CLI::Version to inhibit -v from triggering 651 | - Fix issue with options indicating False 652 | 653 | 0.0.21 2022-07-22T14:09:00+02:00 654 | - Rename --list-additional-options to --list-custom-options 655 | - Rename --json to --json-per-file 656 | - Add option --json-per-line to check each line for JSON 657 | - Allow specification of value with option replacement 658 | 659 | 0.0.20 2022-07-21T14:24:45+02:00 660 | - Add option --json to check JSON files only 661 | 662 | 0.0.19 2022-07-21T13:07:22+02:00 663 | - Add option --dry-run to *not* actually make any changes 664 | - Add option --backup to make backups of any modified files 665 | - Add initial version of all help sections 666 | 667 | 0.0.18 2022-07-20T23:14:37+02:00 668 | - Add option --file-separator-null to get \0 between filenames 669 | - Allow --no-foo as alternative to --/foo 670 | - Add option --modify-files to modify content of files with Callable 671 | 672 | 0.0.17 2022-07-20T12:52:44+02:00 673 | - Rename --I option to --repository to get away from Perlishness 674 | - Rename --M option to --module for better clarity 675 | - Rename option --no-filename to --show-filename for consistency 676 | - Rename option --line-number to --show-line-number for consistency 677 | - Add option --break to determine breaking between matches of files 678 | - Add option --group-matches to only mention filename once 679 | - Adapt documentation 680 | 681 | 0.0.16 2022-07-19T17:15:09+02:00 682 | - Bump dependency on "highlighter" to get ":type support 683 | - Bump dependency on "Files::Containing" to get ":type" support 684 | - Add support for --type functionality 685 | - Initial version of --help documentation 686 | 687 | 0.0.15 2022-07-19T12:03:57+02:00 688 | - Add support for -I functionality 689 | - Add support for -M functionality 690 | - Worked a bit on the pod 691 | 692 | 0.0.14 2022-07-18T20:47:50+02:00 693 | - Add dependency on META::constants 694 | - Add dependency on CLI::Help to get --help support 695 | - Make sure that option replacements occur recursively 696 | - Bump dependency on "Files::Containing" to get :count-only 697 | functionality 698 | - Add support for --count-only functionality 699 | - Cleaned up Changes 700 | 701 | 0.0.13 2022-07-17T10:17:34+02:00 702 | - Fix issue when there was no config file available 703 | - Remove mentions of now removed option names 704 | - Allow editor to be named with --edit 705 | 706 | 0.0.12 2022-07-16T22:17:25+02:00 707 | - Process option substitutions in the order they are specified 708 | - Remove all aliases for each option: each option can only be accessed 709 | by default using a single (long) name, for clarity. Users can add 710 | their own shortcuts with --save, or add a set from someone adhering 711 | to either "grep", "ack" or "ag" options 712 | - Changed wording in documentation to refer to "options" if they are 713 | about optional named arguments on the command line 714 | - Change "list-tags" option to "list-additional-options", to be more 715 | in line with names used 716 | 717 | 0.0.11 2022-07-16T13:29:57+02:00 718 | - Remove "--with" option: you can now use any saved option directly, 719 | without having to use --with 720 | - Bump dependency on "highlighter" to get colum fix for regexes 721 | and fix for highlighting on regexes issue 722 | - Bump dependency on "Edit::Files" to not call editor if nothing to 723 | edit 724 | 725 | 0.0.10 2022-07-15T23:39:04+02:00 726 | - Up dependency on "Edit::Files" in code as well :-( 727 | 728 | 0.0.9 2022-07-15T23:29:55+02:00 729 | - Up dependency on "Edit::Files" to get nvim support 730 | - Add support for --pattern, allowing pattern to be saved with --save 731 | 732 | 0.0.8 2022-07-15T15:59:26+02:00 733 | - Add dependency on "JSON::Fast" 734 | - Add support for --save=tag functionality 735 | - Add support for --with=tag1,tag2 functionality 736 | - Add support for --list-tags functionality 737 | 738 | 0.0.7 2022-07-15T12:55:35+02:00 739 | - Bump dependency on "highlighter" to get "columns" support 740 | - Add scaffolding and documentation for --replace-files argument 741 | - Add dependency on "Edit::Files" 742 | - Add support for "--edit" argument to edit the search result 743 | 744 | 0.0.6 2022-07-14T12:52:34+02:00 745 | - Allow for multiple paths to be specified 746 | - Bump dependency on Files::Containing to be up-to-date 747 | - Add -h / --no-filenames argument to *not* show filenames 748 | - Add -n / --line-number argument to show line numbers 749 | - Add dependency on "as-cli-arguments" for better error reporting 750 | - Remove some premature optimizations 751 | 752 | 0.0.5 2022-07-10T15:26:55+02:00 753 | - No longer follow symlinked directories by default 754 | - Bump dependency on Files::Containing to get :follow-symlinks 755 | capability 756 | - Add -S / --follow-symlinks arguments to follow symlinked directories 757 | 758 | 0.0.4 2022-07-09T14:22:33+02:00 759 | - Fix actual dependency on CLI::Version, spotted by CI 760 | 761 | 0.0.3 2022-07-09T13:59:14+02:00 762 | - Bump dependency on Files::Containing to get new semantics if 763 | a Callable is specified as the pattern 764 | - Bump dependency on highlighter to be able to use the 765 | :summary-if-larger-than feature 766 | - Bump dependency on CLI::Version just for the sake of it 767 | - Improved internal documentation 768 | 769 | 0.0.2 2022-06-26T15:12:36+02:00 770 | - Added a lot of functionality and a lot of pod. Still a lot 771 | of work to do. Suggestions welcome! 772 | 773 | 0.0.1 2022-06-21T13:41:02+02:00 774 | - Initial version 775 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Artistic License 2.0 2 | 3 | Copyright (c) 2000-2006, The Perl Foundation. 4 | 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | This license establishes the terms under which a given free software 11 | Package may be copied, modified, distributed, and/or redistributed. 12 | The intent is that the Copyright Holder maintains some artistic 13 | control over the development of that Package while still keeping the 14 | Package available as open source and free software. 15 | 16 | You are always permitted to make arrangements wholly outside of this 17 | license directly with the Copyright Holder of a given Package. If the 18 | terms of this license do not permit the full use that you propose to 19 | make of the Package, you should contact the Copyright Holder and seek 20 | a different licensing arrangement. 21 | 22 | Definitions 23 | 24 | "Copyright Holder" means the individual(s) or organization(s) 25 | named in the copyright notice for the entire Package. 26 | 27 | "Contributor" means any party that has contributed code or other 28 | material to the Package, in accordance with the Copyright Holder's 29 | procedures. 30 | 31 | "You" and "your" means any person who would like to copy, 32 | distribute, or modify the Package. 33 | 34 | "Package" means the collection of files distributed by the 35 | Copyright Holder, and derivatives of that collection and/or of 36 | those files. A given Package may consist of either the Standard 37 | Version, or a Modified Version. 38 | 39 | "Distribute" means providing a copy of the Package or making it 40 | accessible to anyone else, or in the case of a company or 41 | organization, to others outside of your company or organization. 42 | 43 | "Distributor Fee" means any fee that you charge for Distributing 44 | this Package or providing support for this Package to another 45 | party. It does not mean licensing fees. 46 | 47 | "Standard Version" refers to the Package if it has not been 48 | modified, or has been modified only in ways explicitly requested 49 | by the Copyright Holder. 50 | 51 | "Modified Version" means the Package, if it has been changed, and 52 | such changes were not explicitly requested by the Copyright 53 | Holder. 54 | 55 | "Original License" means this Artistic License as Distributed with 56 | the Standard Version of the Package, in its current version or as 57 | it may be modified by The Perl Foundation in the future. 58 | 59 | "Source" form means the source code, documentation source, and 60 | configuration files for the Package. 61 | 62 | "Compiled" form means the compiled bytecode, object code, binary, 63 | or any other form resulting from mechanical transformation or 64 | translation of the Source form. 65 | 66 | 67 | Permission for Use and Modification Without Distribution 68 | 69 | (1) You are permitted to use the Standard Version and create and use 70 | Modified Versions for any purpose without restriction, provided that 71 | you do not Distribute the Modified Version. 72 | 73 | 74 | Permissions for Redistribution of the Standard Version 75 | 76 | (2) You may Distribute verbatim copies of the Source form of the 77 | Standard Version of this Package in any medium without restriction, 78 | either gratis or for a Distributor Fee, provided that you duplicate 79 | all of the original copyright notices and associated disclaimers. At 80 | your discretion, such verbatim copies may or may not include a 81 | Compiled form of the Package. 82 | 83 | (3) You may apply any bug fixes, portability changes, and other 84 | modifications made available from the Copyright Holder. The resulting 85 | Package will still be considered the Standard Version, and as such 86 | will be subject to the Original License. 87 | 88 | 89 | Distribution of Modified Versions of the Package as Source 90 | 91 | (4) You may Distribute your Modified Version as Source (either gratis 92 | or for a Distributor Fee, and with or without a Compiled form of the 93 | Modified Version) provided that you clearly document how it differs 94 | from the Standard Version, including, but not limited to, documenting 95 | any non-standard features, executables, or modules, and provided that 96 | you do at least ONE of the following: 97 | 98 | (a) make the Modified Version available to the Copyright Holder 99 | of the Standard Version, under the Original License, so that the 100 | Copyright Holder may include your modifications in the Standard 101 | Version. 102 | 103 | (b) ensure that installation of your Modified Version does not 104 | prevent the user installing or running the Standard Version. In 105 | addition, the Modified Version must bear a name that is different 106 | from the name of the Standard Version. 107 | 108 | (c) allow anyone who receives a copy of the Modified Version to 109 | make the Source form of the Modified Version available to others 110 | under 111 | 112 | (i) the Original License or 113 | 114 | (ii) a license that permits the licensee to freely copy, 115 | modify and redistribute the Modified Version using the same 116 | licensing terms that apply to the copy that the licensee 117 | received, and requires that the Source form of the Modified 118 | Version, and of any works derived from it, be made freely 119 | available in that license fees are prohibited but Distributor 120 | Fees are allowed. 121 | 122 | 123 | Distribution of Compiled Forms of the Standard Version 124 | or Modified Versions without the Source 125 | 126 | (5) You may Distribute Compiled forms of the Standard Version without 127 | the Source, provided that you include complete instructions on how to 128 | get the Source of the Standard Version. Such instructions must be 129 | valid at the time of your distribution. If these instructions, at any 130 | time while you are carrying out such distribution, become invalid, you 131 | must provide new instructions on demand or cease further distribution. 132 | If you provide valid instructions or cease distribution within thirty 133 | days after you become aware that the instructions are invalid, then 134 | you do not forfeit any of your rights under this license. 135 | 136 | (6) You may Distribute a Modified Version in Compiled form without 137 | the Source, provided that you comply with Section 4 with respect to 138 | the Source of the Modified Version. 139 | 140 | 141 | Aggregating or Linking the Package 142 | 143 | (7) You may aggregate the Package (either the Standard Version or 144 | Modified Version) with other packages and Distribute the resulting 145 | aggregation provided that you do not charge a licensing fee for the 146 | Package. Distributor Fees are permitted, and licensing fees for other 147 | components in the aggregation are permitted. The terms of this license 148 | apply to the use and Distribution of the Standard or Modified Versions 149 | as included in the aggregation. 150 | 151 | (8) You are permitted to link Modified and Standard Versions with 152 | other works, to embed the Package in a larger work of your own, or to 153 | build stand-alone binary or bytecode versions of applications that 154 | include the Package, and Distribute the result without restriction, 155 | provided the result does not expose a direct interface to the Package. 156 | 157 | 158 | Items That are Not Considered Part of a Modified Version 159 | 160 | (9) Works (including, but not limited to, modules and scripts) that 161 | merely extend or make use of the Package, do not, by themselves, cause 162 | the Package to be a Modified Version. In addition, such works are not 163 | considered parts of the Package itself, and are not subject to the 164 | terms of this license. 165 | 166 | 167 | General Provisions 168 | 169 | (10) Any use, modification, and distribution of the Standard or 170 | Modified Versions is governed by this Artistic License. By using, 171 | modifying or distributing the Package, you accept this license. Do not 172 | use, modify, or distribute the Package, if you do not accept this 173 | license. 174 | 175 | (11) If your Modified Version has been derived from a Modified 176 | Version made by someone other than you, you are nevertheless required 177 | to ensure that your Modified Version complies with the requirements of 178 | this license. 179 | 180 | (12) This license does not grant you the right to use any trademark, 181 | service mark, tradename, or logo of the Copyright Holder. 182 | 183 | (13) This license includes the non-exclusive, worldwide, 184 | free-of-charge patent license to make, have made, use, offer to sell, 185 | sell, import and otherwise transfer the Package with respect to any 186 | patent claims licensable by the Copyright Holder that are necessarily 187 | infringed by the Package. If you institute patent litigation 188 | (including a cross-claim or counterclaim) against any party alleging 189 | that the Package constitutes direct or contributory patent 190 | infringement, then this Artistic License to you shall terminate on the 191 | date that such litigation is filed. 192 | 193 | (14) Disclaimer of Warranty: 194 | THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS 195 | IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED 196 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR 197 | NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL 198 | LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL 199 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 200 | DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF 201 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 202 | -------------------------------------------------------------------------------- /META6.json: -------------------------------------------------------------------------------- 1 | { 2 | "auth": "zef:lizmat", 3 | "authors": [ 4 | "Elizabeth Mattijsen" 5 | ], 6 | "build-depends": [ 7 | ], 8 | "depends": [ 9 | "as-cli-arguments:ver<0.0.8+>:auth", 10 | "Backtrace::Files:ver<0.0.4+>:auth", 11 | "CLI::Version:ver<0.0.9+>:auth", 12 | "highlighter:ver<0.0.21+>:auth", 13 | "IO::Path::AutoDecompress:ver<0.0.3+>:auth", 14 | "JSON::Fast::Hyper:ver<0.0.9+>:auth", 15 | "META::constants:ver<0.0.5+>:auth", 16 | "Needle::Compile:ver<0.0.9+>:auth", 17 | "rak:ver<0.0.65+>:auth", 18 | "String::Utils:ver<0.0.32+>:auth" 19 | ], 20 | "description": "21st century grep / find / ack / ag / rg on steroids", 21 | "license": "Artistic-2.0", 22 | "name": "App::Rak", 23 | "perl": "6.d", 24 | "provides": { 25 | "App::Rak": "lib/App/Rak.rakumod" 26 | }, 27 | "resources": [ 28 | "help.txt", 29 | "help/argument.txt", 30 | "help/code.txt", 31 | "help/content.txt", 32 | "help/debugging.txt", 33 | "help/examples.txt", 34 | "help/faq.txt", 35 | "help/filesystem.txt", 36 | "help/general.txt", 37 | "help/haystack.txt", 38 | "help/item.txt", 39 | "help/listing.txt", 40 | "help/option.txt", 41 | "help/pattern.txt", 42 | "help/philosophy.txt", 43 | "help/resource.txt", 44 | "help/result.txt", 45 | "help/special.txt", 46 | "help/string.txt" 47 | ], 48 | "source-url": "https://github.com/lizmat/App-Rak.git", 49 | "tags": [ 50 | "ACK", 51 | "SEARCH", 52 | "TEXT", 53 | "EDITOR", 54 | "FIND", 55 | "JSON", 56 | "BLAME", 57 | "CSV", 58 | "GIT" 59 | ], 60 | "test-depends": [ 61 | ], 62 | "version": "0.3.19" 63 | } 64 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Ideas / Todo's 2 | ============== 3 | 4 | - expose mapper functionality 5 | - create plugin structure 6 | - modify files met csv-per-line 7 | - support for timezones, selecting on name, but also on properties 8 | - some form if binary support 9 | - search spesh log 10 | - watch file support 11 | - add --tar=name option to create tar-file from files with matches 12 | - add --gist=title option to save search result 13 | - now that we have ngram, perhaps allow for some fuzzy searching? 14 | - support for spreadsheets 15 | - support for colors a la ack 16 | - add support for --type=json-path for the 'jp:' prefix to interpret 17 | the rest of the pattern as a JSON::Path specification. 18 | - XPath en XML file support 19 | - add Log::Timeline support somehow 20 | - conflicts with variables set in default custom list, should not result 21 | in errors, e.g. making --smartcase a default, and then specifying some 22 | combination of options incompatible with --smartcase. 23 | 24 | Errors 25 | ====== 26 | If a file is under version control, it does not mean it actually contains 27 | text. Need to fix that with --blame-per-file/line. 28 | 29 | Options that can either be a flag or a string, appear not to be able to 30 | accept values when used with --save. 31 | 32 | Highlighting multiple patterns doesn't work in a mix of regular strings 33 | and regexes. Looks like regexes are not highlighted if there are none 34 | regexes involved. Is the highlighting then looking for the stringification 35 | of the regex? 36 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-dinky 2 | -------------------------------------------------------------------------------- /bin/rak: -------------------------------------------------------------------------------- 1 | use App::Rak; 2 | 3 | main(); 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /csv/comma.csv: -------------------------------------------------------------------------------- 1 | a,b,c,d 2 | 1,2,3,4 3 | 4,3,2,1 4 | 1,2,3,4 5 | -------------------------------------------------------------------------------- /csv/noheader.csv: -------------------------------------------------------------------------------- 1 | 1,2,3,4 2 | 4,3,2,1 3 | 1,2,3,4 4 | -------------------------------------------------------------------------------- /csv/semicolon.csv: -------------------------------------------------------------------------------- 1 | a;b;c;d 2 | 5;6;7;8 3 | 8;7;6;5 4 | 5;6;7;8 5 | -------------------------------------------------------------------------------- /dist.ini: -------------------------------------------------------------------------------- 1 | name = App-Rak 2 | 3 | [ReadmeFromPod] 4 | ; enabled = false 5 | filename = doc/App-Rak.rakudoc 6 | 7 | [UploadToZef] 8 | 9 | [PruneFiles] 10 | ; match = ^ 'xt/' 11 | 12 | [Badges] 13 | provider = github-actions/linux.yml 14 | provider = github-actions/macos.yml 15 | provider = github-actions/windows.yml 16 | -------------------------------------------------------------------------------- /mbc/eigenstates.mbc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizmat/App-Rak/9f5fbce088cd7d077e9654e379132531e73a6143/mbc/eigenstates.mbc -------------------------------------------------------------------------------- /patterns: -------------------------------------------------------------------------------- 1 | / eigh. / 2 | / nin. / 3 | -------------------------------------------------------------------------------- /pdf/basic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lizmat/App-Rak/9f5fbce088cd7d077e9654e379132531e73a6143/pdf/basic.pdf -------------------------------------------------------------------------------- /q/eight: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | four 6 | five 7 | SIX 8 | seven 9 | eight 10 | -------------------------------------------------------------------------------- /q/five: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | four 6 | five 7 | -------------------------------------------------------------------------------- /q/foo: -------------------------------------------------------------------------------- 1 | *@foo 2 | -------------------------------------------------------------------------------- /q/four: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | four 6 | -------------------------------------------------------------------------------- /q/nine: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | four 6 | five 7 | SIX 8 | seven 9 | eight 10 | nine 11 | -------------------------------------------------------------------------------- /q/one: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | -------------------------------------------------------------------------------- /q/seven: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | four 6 | five 7 | SIX 8 | seven 9 | -------------------------------------------------------------------------------- /q/six: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | four 6 | five 7 | SIX 8 | -------------------------------------------------------------------------------- /q/three: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | 5 | -------------------------------------------------------------------------------- /q/two: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | -------------------------------------------------------------------------------- /q/zero: -------------------------------------------------------------------------------- 1 | zero 2 | -------------------------------------------------------------------------------- /resources/help.txt: -------------------------------------------------------------------------------- 1 | Arguments overview: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | Pattern specification: 5 | Either as first argument, or as --pattern=foo option, or as pattern(s) 6 | in --patterns-from=file option. 7 | 8 | Special markers: 9 | '/ << bar >> /' Raku regex indicated by being bounded by / / 10 | '{ .ends-with("bar") }' Raku code indicated by being bounded by { } 11 | '*.starts-with("foo")' Raku WhateverCode starting with * 12 | 's:foo bar' Multiple patterns, split on whitespace: 13 | jp:foo JSON path specification (with --json-per-xxx) 14 | §string String should match as a word 15 | ^string String should match at start of line 16 | string$ String should match at end of line 17 | ^string$ String should match with line entirely 18 | string String should match anywhere in line 19 | !string String should NOT match anywhere in line 20 | &string Additional string should ALSO match anywhere in line 21 | 22 | Pattern type overrides: 23 | --type=auto Interpret special markers in pattern as above (default) 24 | --type=regex Interpret pattern as a regex (without special markers) 25 | --type=code Interpret pattern as code (without special markers) 26 | --type=json-path Interpret pattern as a JSON path (without jp: prefix) 27 | --type=words Pattern must match as a word 28 | --type=starts-with Pattern must match at start of line 29 | --type=ends-with Pattern must match at end of line 30 | --type=equal Pattern must match entirely 31 | --type=not Pattern must NOT match 32 | --type=split Multiple patterns, split on whitespace 33 | --type=contains Pattern must match anywhere (default if no markers) 34 | 35 | Additional patterns: 36 | --and=bar Must ALSO match anywhere in line 37 | --andnot=bar Must ALSO NOT match anywhere in line 38 | --or=bar May ALSO match anywhere in line 39 | --ornot=bar May ALSO NOT match anywhere in line 40 | 41 | String search pattern modifiers: 42 | --ignorecase Ignore distinction between upper, lower and title case letters 43 | --ignoremark Only compare base characters, ignore additional marks 44 | --smartcase As --ignorecase if pattern does *NOT* contain any uppercase 45 | --smartmark As --ignoremark if pattern does *NOT* contain any accents 46 | 47 | Item producers: 48 | --per-line[=producer] Produce lines for pattern matching 49 | --per-file[=producer] Produce whole file for pattern matching 50 | --encoding[=utf8-c8] Encoding to be used when reading text files 51 | --find Produce absolute paths for pattern matching 52 | --csv-per-line Produce rows from Text::CSV object for pattern matching 53 | --pdf-info Produce meta-info of PDF file as a single hash 54 | --pdf-per-file Produce text of PDF file as a single string 55 | --pdf-per-line Produce text of PDF file as lines of text 56 | --json-per-file Interpret whole file as a single JSON for matching 57 | --json-per-elem Interpret whole file as JSON, match each top level element 58 | --json-per-line Interpret each line as JSON for pattern matching 59 | --blame-per-file Produce Git::Blame::File object for pattern matcing 60 | --blame-per-line Produce Git::Blame::Line objects for pattern matching 61 | --mbc Produce one MoarVM::Bytecode object per file for matching 62 | --mbc-frames Produce MoarVM::Bytecode::Frame objects for matching 63 | --mbc-strings Produce MoarVM::Bytecode string-heap strings for matching 64 | --unicode Produce names of codepoints for pattern matching 65 | 66 | Code pattern helpers: 67 | --repository=lib First look for any modules to load in the "lib" directory 68 | --module=foo Load module "foo" before compiling Raku code pattern 69 | --quietly Disable warnings when executing pattern (default: False) 70 | --silently[=out,err] Capture output when executing pattern (default: False) 71 | 72 | Haystack specification: 73 | path1 path2 ... All other arguments are paths (default: current dir) 74 | --paths=specification Comma separated list of paths instead of ^^ 75 | --files-from=file Read files to inspect from given file 76 | --paths-from=file Read path specifications from given file 77 | --under-version-control Select paths that are under version control 78 | --recurse-symlinked-dir Recurse into symlinked directories? (default: don't) 79 | --recurse-unmatched-dir Recurse into directories not matching (default: don't) 80 | --eco-code[=name] All code in local ecosystem cache 81 | --eco-doc[=name] All documentation in local ecosystem cache 82 | --eco-meta[=name] One or more Raku ecosystem's module's META 83 | --eco-provides[=name] All code in modules in local ecosystem cache 84 | --eco-scripts[=name] All code in scripts in local ecosystem cache 85 | --eco-tests[=name] All code in test files in local ecosystem cache 86 | --rakudo-all All files in Rakudo 87 | --rakudo-c All C programming language files in Rakudo 88 | --rakudo-doc All documentation files 89 | --rakudo-java All Java programming language files in Rakudo 90 | --rakudo-js All Javascript programming language files in Rakudo 91 | --rakudo-nqp All NQP related files in Rakudo 92 | --rakudo-perl All Perl programming language files in Rakudo 93 | --rakudo-raku All Raku Programming Language files in Rakudo 94 | --rakudo-shell All shell scripts / batch files in Rakudo 95 | --rakudo-test All testing related files in Rakudo 96 | --rakudo-yaml All files containing YAML of some sort in Rakudo 97 | 98 | Filesystem filters: 99 | --accessed=condition Check on epoch when file was last accessed 100 | --accept=code Given an IO of a file, return if file acceptable 101 | --auto-decompress File may be gzipped (.gz) or bzip2ed (.bz2) 102 | --blocks=condition Number of filesystem blocks used by file 103 | --created=condition Check on epoch when file was created 104 | --deny=code Given an IO of a file, return if **NOT** acceptable 105 | --device-number Number of device on which file is located 106 | --dir=expression Directory basename filter, default: not ^. 107 | --exec=program Run program, include if successful 108 | --extensions=spec By group (e.g. #raku) and/or comma separated 109 | --file=expression File basename filter, default: all 110 | --filesize=condition Number of bytes of data used by file 111 | --group=selector File is owned by group names / expression 112 | --gid=condition File is owned by given gid 113 | --hard-links=condition Number of hard-links to file on file system 114 | --has-setgid Has SETGID bit set in attributes 115 | --has-setuid Has SETUID bit set in attributes 116 | --inode=condition Inode number of file on file system 117 | --is-empty File does (not) contain any data 118 | --is-executable File can (not) be executed by owner 119 | --is-group-executable File can (not) be executed by group members of owner 120 | --is-group-readable File can (not) be read by group members of owner 121 | --is-group-writable File can (not) be written to by group members of owner 122 | --is-moarvm File is (not) a MoarVM bytecode file 123 | --is-owned-by-group File is (not) owned by group of user 124 | --is-owned-by-user File is (not) owned by user 125 | --is-pdf File is (not) a PDF file 126 | --is-readable File can (not) be read by owner 127 | --is-sticky Has STICKY bit set in attributes 128 | --is-symbolic-link File is (not) a symbolic link 129 | --is-text File contains (does not contain) text 130 | --is-world-executable File can (not) be executed by anybody 131 | --is-world-readable File can (not) be read by anybody 132 | --is-world-writable File can (not) be written to by anybody 133 | --is-writable File can (not) be written to by owner 134 | --meta-modified=cond Check on epoch when meta-info of file was last changed 135 | --mode=condition The full mode value of the file 136 | --modified=condition Check on epoch when file was last changed 137 | --shell=action Run shell command, include if successful 138 | --user=selector File is owned by user names / expression 139 | --uid=condition File is owned by given uid 140 | 141 | Result modifiers: 142 | --also-first=N List first N lines if there is a match 143 | --always-first=N List first N lines always 144 | --context=N List N lines around any line with a match 145 | --before-context=N List N lines before any line with a match 146 | --after-context=N List N lines after any line with a match 147 | --paragraph-context List all lines in the same paragraph around a match 148 | --passthru-context List all lines if there is at least one match 149 | --passthru List all lines always 150 | --invert-match Select lines that do **not** match 151 | --max-matches-per-file=N Maximum number of matches per file, default: all 152 | --count-only Only return count of matches 153 | --stats-only Only return statistics of the search 154 | --files-with-matches Only return filenames with matches 155 | --files-without-matches Only return filenames without matches 156 | --matches-only Only produce the actual matches 157 | --unique Only return unique lines 158 | --frequencies Only return lines and their frequencies 159 | --classify=classifier Classify lines by a key (or not) 160 | --categorize=categorizer Classify lines by zero or more keys 161 | 162 | Listing modifiers: 163 | --human Force defaults as if a human is watching 164 | --absolute Show paths as absolute paths 165 | --break[=string] String to show between different files 166 | --group-matches Show filename only once on a separate line 167 | --show-blame Show git blame information if possible 168 | --show-filename Show the filename in which match occurred 169 | --file-separator-null Separate filenames with null bytes 170 | --show-item-number Show the item number in which match occurred 171 | --summary-if-larger-than=N Summarize matching line if longer than N chars 172 | --trim Remove whitespace, true if no context 173 | --highlight Highlight any matches 174 | --highlight-before=xxx String to put before match 175 | --highlight-after=yyy String to put after match 176 | --proximate[=N] Grouping of matched lines 177 | --only-first[=N] Only N results, default N = 1, absence = 1000 178 | --output-file=filename Store output to indicated file (default: STDOUT) 179 | --output-dir=directory Store output ino indicated directory / group 180 | --pager Pager to use (default: RAK_PAGER // none) 181 | --stats Also show statistics 182 | 183 | Content modifiers: 184 | --modify-files Change content of files using the Callable pattern 185 | --backup[=extension] Make backup of file with extension (default: .bak) 186 | --rename-files Rename files using the Callable pattern 187 | --dryrun Don't actually make any changes, just run the process 188 | --no-modifications Do not allow any modifications to be made 189 | 190 | Resource usage: 191 | --batch[=N] Max number of files to process in a thread (default: 64) 192 | --degree[=N | code] Max workers to use for processing (default: cores - 1) 193 | 194 | Special options: 195 | --edit[=editor] Go edit the result in an editor, (default EDITOR or vim) 196 | --vimgrep Produce output in :vimgrep format 197 | --checkout=string Checkout branch if pattern matches single branch name 198 | --sourcery Treat pattern as code, use candidates as result 199 | --backtrace Interpret text as a Raku backtrace, use as result 200 | --execute-raku[=code] Run raku code for exception, use as result 201 | 202 | Option management: 203 | --save=name Translate --name to all other options specified, 204 | remove if --save was the only option specified 205 | --description=text Add description to custom option 206 | --ack Activate "ack" compatibility options 207 | --list-custom-options List all previously saved options 208 | 209 | General options: 210 | --help Show this 211 | --help=subject Show additional help about subject, out of: 212 | argument | code | content | debugging | examples | faq 213 | filesystem | general | haystack | item | listing | option 214 | pattern | philosophy | resource | result | special | string 215 | --help foo Search for "foo" in all help subjects 216 | --help=faq foo Search for "foo" in subject "faq" 217 | --progress Show search progress on STDERR 218 | --version Show version information 219 | --verbose Be more verbose, if applicable 220 | 221 | Debugging options: 222 | --dont-catch Let code exceptions be thrown with backtrace 223 | --list-known-extensions Show all known extensions and their group namep 224 | --list-expanded-options List all options given after having been expanded 225 | --rak Show arguments to "rak" plumbing before running 226 | 227 | Argument format: 228 | foo Positional argument 229 | --foo Option "foo" is True 230 | --/foo Option "foo" is False 231 | --no-foo Option "foo" is False 232 | --foo=bar Option "foo" is "bar" 233 | -fo Single letter options "f" and "o" True 234 | -/ba Single letter options "b" and "a" False 235 | -j2 Single letter option "j" with value 2 236 | -------------------------------------------------------------------------------- /resources/help/argument.txt: -------------------------------------------------------------------------------- 1 | Argument format: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | In short: 5 | foo Positional argument 6 | --foo Option "foo" is True 7 | --/foo Option "foo" is False 8 | --no-foo Option "foo" is False 9 | --foo=bar Option "foo" is "bar" 10 | -fo Single letter options "f" and "o" True 11 | -/ba Single letter options "b" and "a" False 12 | -j2 Single letter option "j" with value 2 13 | 14 | More verbose: 15 | Command line arguments come in two types: positional and named. 16 | Named arguments start with a "-" and are usually referred to as 17 | "options" in the documentation. And argument that does not start 18 | with a hyphen, is considered to be a positional argument. 19 | 20 | Named and positional arguments can be specified in any order. 21 | 22 | Note that the values of some arguments will need quoting in some 23 | form according to rules determined by the shell being used. 24 | 25 | If a named argument starts with single "-", then the name is 26 | considered to be a sequence of one letter named arguments 27 | with a boolean True value. Except if all of the characters 28 | after the first letter are numeric, then these are considered 29 | a numerical value specified with that single letter named 30 | argument. 31 | 32 | If a named argument starts with two hyphens, then the characters 33 | after it (until an optional equal sign) are considered to be 34 | the name of a single named argument. If such a named argument 35 | contains an equal sign, then the characters after the equal sign 36 | are considered the value of that named argument. 37 | 38 | If there is no equal sign, then the named argument is supposed 39 | to be a Boolean True value. Except when there is a slash, or 40 | "no-" after the first hyphen(s), in which case the named argument 41 | is considered to have the boolean False value. 42 | -------------------------------------------------------------------------------- /resources/help/code.txt: -------------------------------------------------------------------------------- 1 | Code pattern helpers: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --module=foo 5 | 6 | Indicate the Raku module to be loaded before compiling Raku 7 | code pattern. Can be specfied more than once. Defaults to 8 | no additional module loading. Also known as -M when calling 9 | Raku itself. 10 | 11 | Example: 12 | # show all non-empty lines as space separated codepoints 13 | # using the experimental "pack" function 14 | $ rak --module='experimental :pack' '{ (pack "A*", $_).List }' 15 | 16 | --quietly 17 | 18 | Indicate whether warnings should be disabled when executing 19 | a Callable pattern. Defaults to False. 20 | 21 | --repository=lib 22 | 23 | Indicate the directory of a filesystem repository that should 24 | be used first to look for module loading. Defaults to no 25 | additional repositories. Also known as -I when calling Raku 26 | itself. 27 | 28 | --silently[=out,err] 29 | 30 | Indicate whether any output that is created by executing a 31 | Callable pattern, should be prevented from actually being 32 | shown. If specified as a flag, will capture both STDOUT 33 | and STDERR. Can also specifically capture STDOUT (with 34 | "out") and/or capture STDERR (with "err"). Defaults to 35 | no preventing any output from a Callable pattern. 36 | -------------------------------------------------------------------------------- /resources/help/content.txt: -------------------------------------------------------------------------------- 1 | Content modifiers: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --backup[=extension] 5 | 6 | Only makes sense when the --modify-files is also specified. Indicates 7 | whether backups should be made when a file is modified. If an extension 8 | is specified, then that will be added to the name of the file. If 9 | specified as a flag, then ".bak" will be assumed. Defaults to not 10 | making any backup. 11 | 12 | --dryrun 13 | 14 | Only makes sense when either the --modify-files or --rename-files is 15 | also specified. Indicates that *no* actual changes should be performed. 16 | Defaults to False, allowing for changes to be made. 17 | 18 | --modifications 19 | 20 | Indicate whether modifications with --modify-files and --rename-files 21 | are allowed. Defaults to True, hence it will probably only be actually 22 | used in the negation case: --no-modifications or --/modifications to 23 | disallow making any modifications. 24 | 25 | --modify-files 26 | 27 | Only makes sense with a Callable pattern. Indicates that the inspected 28 | files may be potentially changed. If the value returned by the 29 | Callable pattern is not True/False/Nil/Empty and different from the 30 | given line, then that line will be replaced by the returned value(s). 31 | Else it will be kept unchanged because of an implicit --passthru-context 32 | argument being active. 33 | 34 | Files are presented in a sorted order, allowing for repeatable and 35 | ordered modification. The $*N dynamic variable (initialized to 0) is 36 | available to the pattern, to allow keeping state between files. 37 | 38 | Defaults to False, indicating that files should **not** be changed. Can 39 | also specify --dryrun to see which files would be changed without actually 40 | making any changes. 41 | 42 | By default, lines will be presented **without** their line ending. 43 | If you want to have them included, specify --with-line-endings. 44 | 45 | --rename-files 46 | 47 | Only makes sense with a Callable pattern. Assumes --find semantics 48 | if specified. Indicates that the names of the selected files may be 49 | potentially changed. If the value returned by the Callable pattern 50 | is not True/False/Nil/Empty and different from the given filename, 51 | then the name of the file will be replaced by the returned value. 52 | Defaults to False, indicating that no files will be renamed. 53 | 54 | Files are presented in a sorted order, allowing for repeatable and 55 | ordered renaming. The $*N dynamic variable (initialized to 0) is 56 | available to the pattern, to allow keeping state between files. 57 | 58 | If a file is under version control (currently only 59 | "git" is supported) will make sure that the version control system 60 | will be aware of the rename. Can also specify --dryrun to see which 61 | files would be renamed without actually making any changes. 62 | -------------------------------------------------------------------------------- /resources/help/debugging.txt: -------------------------------------------------------------------------------- 1 | Debugging options: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --dont-catch 5 | 6 | Indicate that code exceptions should be thrown with Raku backtrace. 7 | Defaults to False, catching any exception and turn this into a 8 | limited error message. Mostly intended for App::Rak developers 9 | and for error reporting by users when making a Github issue. 10 | 11 | --list-expanded-options 12 | 13 | If specified with a True value, do not execute search query. 14 | Instead show all the options that would be executed internally 15 | after all custom options (previously saved with --save) have been 16 | expanded. Defaults to False, performing the query as intended. 17 | Mostly intended for users that don't understand the presented 18 | results from the given arguments, and potentially for error 19 | reporting by users when making a Github issue. 20 | 21 | --list-known-extensions 22 | 23 | If specified with a True value, will list all of the extension 24 | groups known, and which extensions are considered part or that 25 | group. No other arguments should be specified. Mainly intended 26 | as documentation for both users as well as App::Rak developers. 27 | 28 | --rak 29 | 30 | If specified with a True value, will show the arguments that will 31 | be passed to the "rak" plumbing logic. Intended to be used by 32 | App::Rak developers. Defaults to False, not showing these arguments. 33 | -------------------------------------------------------------------------------- /resources/help/examples.txt: -------------------------------------------------------------------------------- 1 | Examples: 2 | ‒‒‒‒‒‒‒‒‒ 3 | 4 | # Find all occurrences of the pattern ‘patricia’ in a file 5 | $ rak patricia myfile 6 | 7 | # Same as above but looking only for complete words 8 | $ rak patricia myfile --type=words 9 | 10 | # Count occurrences of the exact pattern FOO 11 | $ rak FOO myfile --count-only 12 | 13 | # Same as above but ignoring case 14 | $ rak FOO myfile --count-only --ignorecase 15 | 16 | # Find all occurrences of the pattern ‘.Pp’ at the beginning of a line 17 | $ rak .Pp myfile --type=starts-with 18 | 19 | # Find all lines in a file which do not contain the words ‘foo’ or ‘bar’ 20 | $ rak '/ << foo | bar >> /' myfile --invert-match 21 | 22 | # Peruse the file ‘calendar’ looking for either 19, 20, or 25 23 | $ rak '/ 19 | 20 | 25 /' calendar 24 | 25 | # Show the 20 most frequent words in lowercase 26 | # rak '*.match(/ \w+ /, :g)>>.lc.Slip' --frequencies --only-first=20 27 | 28 | # Rename files with 3 digits word bounded with an interval of 10 29 | $ rak '*.subst(/ << \d ** 3 >> /, { ($*N += 10).fmt("%03d") })' --rename-files 30 | 31 | # Show all line the same as the previous line 32 | $ rak '{ state $last = ""; LEAVE $last = $_; $_ eq $last }' 33 | -------------------------------------------------------------------------------- /resources/help/faq.txt: -------------------------------------------------------------------------------- 1 | Frequently Asked Questions: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | Q: How can I limit to files with a certain extension? 5 | A: Use "--extensions=name" where "name" is the actual extension. Note that 6 | a period will be added for the actual comparisons. 7 | 8 | Q: How can I limit to files without extension? 9 | A: Use "--extensions=,". This works because the comma is used to indicate 10 | multiple extensions to accept. In this case, since there are no letters 11 | between the "=" and the ",", it specifies a zero character extension. 12 | 13 | -------------------------------------------------------------------------------- /resources/help/filesystem.txt: -------------------------------------------------------------------------------- 1 | File system filters: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | File system filters refine the inital selection of files as indicated by 5 | the haystack arguments. 6 | 7 | Refining by name: 8 | 9 | These arguments partially overlap in functionality. If none of these 10 | arguments are specified, then --dir (accepting *all* directories for 11 | recursion) and --is-text (accepting only files that appear to contain 12 | text, rather than binary information). 13 | 14 | --auto-decompress 15 | 16 | Flag. If specified with a True value, will accept compressed files 17 | with the .gz (gzip) or .bz2 (bzip2) extension, if the extension was 18 | otherwise acceptable. Will automatically decompress files for 19 | inspection. 20 | 21 | --dir=expression 22 | 23 | Specifies the expression (either as a string, regular expression or as 24 | a Callable) that will be matched with the basename of a directory. 25 | This expression should return True to have a subdirectory be included 26 | for recursion. Defaults to any directory of which the basename does 27 | **NOT** start with a period. Specifying --dir as a flag will include 28 | *all* subdirectories, while specifying --/dir (or --not-dir) will 29 | cause no recursion to happen whatsoever (this can be handy when only 30 | interested in the files of the current directory). 31 | 32 | --extensions=list 33 | 34 | Specifies the extensions that a filename should have, to be accepted. 35 | Can either be a single extension (group), or a comma-separated list 36 | of extensions (groups), or '*' to indicate all known extensions. 37 | The predefined extension groups are: #raku, #perl, #cro, #text, #c, 38 | #c++, #yaml, #ruby, #python, #js, #html, #markdown, #json, #jsonl, 39 | #csv, #config and #text. Conflicts with --file. 40 | 41 | --file=expression 42 | 43 | Specifies the expression (either as a string, regular expression or 44 | as a Callable) that will be matched with the basename of a file. 45 | This expression should return True to have a file be included. 46 | Conflicts with --extensions. 47 | 48 | If specified as --file, will accept *all* file paths for inclusion. 49 | If specified as --/file, will only produce paths of directories if --find 50 | is also specified. 51 | 52 | Refining by content: 53 | 54 | --is-moarvm 55 | 56 | Flag. If specified with a True value, indicates that only files that 57 | appear to be MoarVM bytecode files, should be selected. If specified 58 | with a False value, indicates that only files that do **NOT** appear 59 | to be MoarVM bytecode files, should be selected. 60 | 61 | --is-pdf 62 | 63 | Flag. If specified with a True value, indicates that only files that 64 | appear to be PDF files, should be selected. If specified with a False 65 | value, indicates that only files that do **NOT** appear to be PDF 66 | files, should be selected. 67 | 68 | --is-text 69 | 70 | Flag. If specified with a True value, indicates that only files that 71 | appear to contain text (rather than binary data) should be selected. 72 | If specified with a False value, indicates that only files with binary 73 | data should be selected. However, actual searching for binary data is 74 | not yet implemented, so this feature can only be used in conjunction 75 | with --find. 76 | 77 | --accept=code 78 | 79 | Specifies the code that should be executed that should return True if 80 | the path is acceptable, given an IO::Path object of the path. 81 | 82 | Example: 83 | # Include files that have "use Test" in them 84 | $ rak --accept='*.slurp.contains("use Test")' 85 | 86 | --deny=code 87 | 88 | Specifies the code that should be executed that should return True if 89 | the path is **NOT** acceptable, given an IO::Path object of the path. 90 | 91 | Example: 92 | # Include files that **NOT** have "use Test" in them 93 | $ rak --deny='*.slurp.contains("use Test")' 94 | 95 | Refining by epoch: 96 | 97 | These arguments expect a Callable that will be given the associated 98 | epoch value of the file being checked. See 99 | https://raku.land/zef:lizmat/App::Rak#checking-times-on-files for 100 | more information about possible features. 101 | 102 | --accessed=condition Check on epoch when file was last accessed 103 | --created=condition Check on epoch when file was created 104 | --meta-modified=cond Check on epoch when meta-info of file was last changed 105 | --modified=condition Check on epoch when file was last changed 106 | 107 | Refining by user / group name: 108 | 109 | These arguments either expect a Callable that will be given a string 110 | associated with the file, which is expected to return True to accept 111 | the file. Or it may consist of a comma-separated list of names of 112 | acceptable names, optionally prefixed with an exclamation mark to 113 | indicate that the specified names are unacceptable. 114 | 115 | --user=selector File is owned by user names / expression 116 | --group=selector File is owned by group names / expression 117 | 118 | Refining by user / group ID: 119 | 120 | These arguments expect a Callable that will be given a numeric ID 121 | associated with the owner of file. It is expected to return True 122 | to have the file accepted. Note that this may actually only work 123 | on Unixy file systems. 124 | 125 | --uid=condition File is owned by numeric uid given 126 | --gid=condition File is owned by numeric gid given 127 | 128 | Refining by numeric meta value: 129 | 130 | These arguments expect a Callable (except --is-empty) that will be 131 | given the associated numeric value, and which should return True 132 | to have the file in question being accepted. 133 | 134 | --blocks=condition Number of file system blocks used by file 135 | --device-number=cond Number of device on which file is located 136 | --filesize=condition Number of bytes of data used by file 137 | --is-empty Number of bytes of data used by file is zero 138 | --hard-links=cond Number of hard-links to file on file system 139 | --inode=condition Inode number of file on file system 140 | --mode=condition The full mode value of the file 141 | 142 | Refining by external program: 143 | 144 | These arguments can be used to accept a file if an external 145 | program (either direct or through a shell) will successfully 146 | run to completion when given the full path of the filename 147 | being inspected. The filename is available as $_ in the 148 | expression that you give. 149 | 150 | --exec=program Run program, include if successful 151 | --shell=action Run shell command, include if successful 152 | 153 | Refining by attribute (not) being set: 154 | 155 | These arguments can be both specified with a True value 156 | (e.g. --is-readable) or with a False value (--/is-readable or 157 | --no-is-readable). If specified with a True value, will accept 158 | a file if that attribute is set. If specified with a False value, 159 | will accept a file if that attribute is **NOT** set. Note that 160 | some of these attributes will actually only work on Unixy 161 | file systems. 162 | 163 | --has-setgid Has SETGID bit (not) set in attributes 164 | --has-setuid Has SETUID bit (not) set in attributes 165 | --is-executable File can (not) be executed by owner 166 | --is-readable File can (not) be read by owner 167 | --is-writable File can (not) be written to by owner 168 | --is-group-executable File can (not) be executed by group members of owner 169 | --is-group-readable File can (not) be read by group members of owner 170 | --is-group-writable File can (not) be written to by group members of owner 171 | --is-owned-by-group File is (not) owned by group of user 172 | --is-owned-by-user File is (not) owned by user 173 | --is-symbolic-link File is (not) a symbolic link 174 | --is-sticky Has STICKY bit (not) set in attributes 175 | --is-world-executable File can (not) be executed by anybody 176 | --is-world-readable File can (not) be read by anybody 177 | --is-world-writable File can (not) be written to by anybody 178 | -------------------------------------------------------------------------------- /resources/help/general.txt: -------------------------------------------------------------------------------- 1 | General options: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --help 5 | 6 | Show an overview of all options of the "rak" command line interface. 7 | 8 | --help=subject 9 | 10 | Show additional information about the given subject. Possible subjects 11 | are (in alphabetical order) 12 | 13 | - argument Argument format 14 | - code Code pattern helpers 15 | - content Content modifiers 16 | - debugging Debugging options 17 | - examples Usage examples 18 | - faq Frequently asked questions 19 | - filesystem File system filters 20 | - general General options 21 | - haystack Haystack specification 22 | - item Item producers 23 | - listing Listing modifiers 24 | - option Option management 25 | - pattern Pattern specification 26 | - philosophy Ruminations 27 | - resource Resource usage 28 | - result Result modifiers 29 | - special Special options 30 | - string String search pattern modifiers 31 | 32 | --help foo 33 | 34 | Show information about "foo" in all help subjects, and show the entire 35 | logical paragraph of any match. 36 | 37 | --help=faq foo 38 | 39 | Show information about "foo" in the given subject only, and show the 40 | entire logical paragraph of any match. 41 | 42 | --progress 43 | 44 | Show progress of searching as "nr-files / nr-lines / nr-matches" on 45 | STDERR, updated 5 times per second 46 | 47 | --version 48 | 49 | Show version information about the "rak" command line interface. 50 | 51 | --verbose 52 | 53 | Show more information if possible, depending on the other arguments. 54 | -------------------------------------------------------------------------------- /resources/help/haystack.txt: -------------------------------------------------------------------------------- 1 | Haystack specification: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | The "haystack" is the original selection of files that will be examined, 5 | which will then be refined by the file system arguments, before being 6 | in actual matching of the pattern. 7 | 8 | Note that almost all (implicit) options in the haystack specification 9 | will be in conflict with any of the other options. So don't use them 10 | at the same time! 11 | 12 | path1 path2 ... OR --paths=path1,path2 13 | 14 | The pattern to be used for matching is either specified with the 15 | --pattern argument, or by the first positional argument. All (other) 16 | positionals arguments are considered to be paths to be investigated 17 | for files and subdirectories. If only a pattern has been specified 18 | then the current directory will be assumed. Paths can also be 19 | specified with the --paths argument, which expects a comma separated 20 | list of paths to investigate. 21 | 22 | --files-from=file 23 | 24 | If specified, expects the name of file containing the names of the 25 | *files* to be examined. Relative filenames will be assumed to be 26 | relative to the current directory. Conflicts with --paths, 27 | --paths-from, --recurse-symlinked-dir, --recurse-unmatched-dir and 28 | --under-version-control. 29 | 30 | --paths-from=file 31 | 32 | If specified, expects the name of file containing the names of the 33 | *path* to be recursed into to find files. Relative pathnames will 34 | be assumed to be relative to the current directory. Conflicts 35 | with --paths, --files-from and --under-version-control. 36 | 37 | --recurse-symlinked-dir 38 | 39 | If specified with a True value, will cause the file collection 40 | process to recurse into symlinked directories. Default is False, 41 | so that no recursion into symlinked directories will occur. 42 | Conflicts with --files-from and --under-version.control. 43 | 44 | --recurse-unmatched-dir 45 | 46 | If specified with a True value, will cause the file collection 47 | process to recurse into directories that did **NOT** satisfy the 48 | (implicit) --dir specification. Default is False, so that 49 | recursion will only occur into directories that satisfy the 50 | --dir specification. Conflicts with --files-from and 51 | --under-version.control. 52 | 53 | --under-version-control[=git] 54 | 55 | If specified indicates which version control system should be 56 | interrogated to find out which files are currently known to the 57 | version control system. If specified with a True value, assumes 58 | "git" as the version control system. Currently, this is the only 59 | version control system supported. Conflicts with --paths, 60 | --files-from, --paths-from, --recurse-symlinked-dir and 61 | --recurse-unmatched-dir. 62 | 63 | --eco-code=[rea|fez] 64 | 65 | Indicate that all the files that can contain Raku code in the local 66 | ecosystem cache (as generated by Ecosystem::Cache) should be searched. 67 | If specified as a flag, will assume "rea" (Raku Ecosystem Archive). 68 | 69 | --eco-doc=[rea|fez] 70 | 71 | Indicate that all the files that can documentation in the local 72 | ecosystem cache (as generated by Ecosystem::Cache) should be searched. 73 | If specified as a flag, will assume "rea" (Raku Ecosystem Archive). 74 | 75 | --eco-meta[=name,name2] 76 | 77 | Intended to be used by Raku ecosystem maintainers. Indicates the 78 | name of one or more Raku ecosystems (separated by commmas) of 79 | which to inspect the META6.json information of all its modules. 80 | Currently supported names are: 81 | 82 | - p6c - the original git ecosystem (deprecated) 83 | - cpan - the ecosystem piggybacking on PAUSE / CPAN (deprecated) 84 | - fez - the currently recommended ecosystem for new modules / updates 85 | - rea - the Raku Ecosystem Archive 86 | 87 | Defaults to "rea" if specified as a flag. Implies --json-per-elem. 88 | 89 | Examples: 90 | # show all unique module names by an author from the REA 91 | $ rak '{ .author eq "Scooby Doo" }' --eco-meta 92 | 93 | # same, but now from the p6c and cpan ecosystems 94 | $ rak '{ .author eq "Scooby Doo" }' --eco-meta=p6c,cpan 95 | 96 | Assumes "zef" is installed and its meta information is available. 97 | 98 | --eco-provides=[rea|fez] 99 | 100 | Indicate that the module files (from the "provides" section of the 101 | meta-information in a distribution) in the local ecosystem cache 102 | (as generated by Ecosystem::Cache) should be searched. If specified 103 | as a flag, will assume "rea" (Raku Ecosystem Archive). 104 | 105 | --eco-scripts=[rea|fez] 106 | 107 | Indicate that the scripts (from the "bin" directory of a distribution) 108 | in the local ecosystem cache (as generated by Ecosystem::Cache) should 109 | be searched. If specified as a flag, will assume "rea" (Raku Ecosystem 110 | Archive). 111 | 112 | --eco-tests=[rea|fez] 113 | 114 | Indicate that the test files (from the "t" and "xt" directories of a 115 | distribution) in the local ecosystem cache (as generated by 116 | Ecosystem::Cache) should be searched. If specified as a flag, will 117 | assume "rea" (Raku Ecosystem Archive). 118 | 119 | --rakudo-all 120 | 121 | Indicate that all the files recognized by the Rakudo cache (as generated 122 | by Rakudo::Cache) should be searched. 123 | 124 | --rakudo-c 125 | 126 | Indicate that the files recognized as C programming language files by 127 | the Rakudo cache (as generated by Rakudo::Cache) should be searched. 128 | 129 | --rakudo-doc 130 | 131 | Indicate that the files recognized as documentation files by the Rakudo 132 | cache (as generated by Rakudo::Cache) should be searched. 133 | 134 | --rakudo-java 135 | 136 | Indicate that the files recognized as Java programming language files 137 | by the Rakudo cache (as generated by Rakudo::Cache) should be searched. 138 | 139 | --rakudo-js 140 | 141 | Indicate that the files recognized as Javascript programming language 142 | files by the Rakudo cache (as generated by Rakudo::Cache) should be searched. 143 | 144 | --rakudo-nqp 145 | 146 | Indicate that the files recognized as NQP related files by the Rakudo cache 147 | (as generated by Rakudo::Cache) should be searched. 148 | 149 | --rakudo-perl 150 | 151 | Indicate that the files recognized as Perl programming language files 152 | by the Rakudo cache (as generated by Rakudo::Cache) should be searched. 153 | 154 | --rakudo-raku 155 | 156 | Indicate that the files recognized as Raku Programming Language files 157 | by the Rakudo cache (as generated by Rakudo::Cache) should be searched. 158 | 159 | --rakudo-shell 160 | 161 | Indicate that the files recognized as shell scripts / batch files by 162 | the Rakudo cache (as generated by Rakudo::Cache) should be searched. 163 | 164 | --rakudo-test 165 | 166 | Indicate that the files recognized as test related files by the Rakudo 167 | cache (as generated by Rakudo::Cache) should be searched. 168 | 169 | --rakudo-yaml 170 | 171 | Indicate that the files recognized as files containing YAML of some sort 172 | by the Rakudo cache (as generated by Rakudo::Cache) should be searched. 173 | -------------------------------------------------------------------------------- /resources/help/item.txt: -------------------------------------------------------------------------------- 1 | Item producers: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | These arguments determine the items that will be presented to the 5 | pattern matcher. 6 | 7 | --per-line[=producer] 8 | 9 | Produce the lines of text for each selected file. Can be specified as 10 | a flag (which is actually the default behaviour if no other producer 11 | has been specified). Can also be specified as a Callable pattern, which 12 | is then responsible for producing lines to be presented to the pattern 13 | matcher. 14 | 15 | Examples: 16 | # look for "foo" in all files with known extensions from current directory 17 | # and show each line that has "foo" in it 18 | $ rak foo 19 | 20 | # look for "foo" only in the last 10 lines of each file and show each line 21 | # that has "foo" in it 22 | $ rak --per-line='*.lines.head(10)' foo 23 | 24 | --per-file[=producer] 25 | 26 | Produce the whole file to the pattern matcher. Can be specified as a 27 | flag. Can also be specified as a Callable pattern, which is then 28 | responsible for producing the content to be presented to the matcher. 29 | 30 | Examples: 31 | # all names of files that have the string "foo" in them 32 | $ rak --per-file --files-with-matches foo 33 | 34 | --encoding[=utf8-c8] 35 | 36 | Encoding to be used when reading text files. Defaults to "utf8-c8". 37 | Other options are "utf8" and "ascii", but these encoding are more 38 | prone to producing errors. 39 | 40 | --find 41 | 42 | Produce the paths from the haystack specification and the filesystem 43 | filters as items for matching. A Callable pattern will be presented 44 | with an IO::Path object, other matching uses the absolute path. 45 | 46 | Examples: 47 | # all paths that contain "special" in their name 48 | $ rak --find special 49 | 50 | # number of files with "special" in their name 51 | $ rak --find special --count-only 52 | 53 | # all paths of which basename starts with an "f" 54 | $ rak --find '*.basename.starts-with("f")' 55 | 56 | # all basenames and their frequencies of which the basename 57 | # starts with an "f" 58 | $ rak --find '{ .basename if .basename.starts-with("f")}' --frequencies 59 | 60 | --json-per-file 61 | 62 | Attempt to parse the whole file as JSON. If parsing is successful, 63 | pass the obtained data-structure as an item to the pattern matcher. 64 | Only files with an extension from the #json extension group will be 65 | tried, unless overridden by any explicit extension specification. 66 | 67 | Example: 68 | # Produce the unique "name" fields of which the "auth" field starts 69 | # with "zef:" (basically all modules in the zef ecosystem) of all 70 | # .json files that can be found in the REA/main directory and its 71 | # subdirectories. 72 | $ rak --json-per-file '{ . if . ~~ /^zef:/ }' --unique REA/meta 73 | 74 | --json-per-elem 75 | 76 | Attempt to parse the whole files as JSON. If parsing is successful, 77 | pass all top-level elements of the data-structure as items to the 78 | pattern matcher. Only files with an extension from the #json 79 | extension group will be tried, unless overridden by any explicit 80 | extension specification. 81 | 82 | Example: 83 | # Produce the unique "name" fields of which the "auth" field starts 84 | # with "zef:" (basically all modules in the zef ecosystem) from the 85 | # REA/META.json file containing all meta information of the Raku 86 | # Ecosystem Archive. 87 | $ rak --json-per-elem '{. if . ~~ /^zef:/}' --unique REA/META.json 88 | 89 | --json-per-line 90 | 91 | Attempt to parse each line in the file as JSON. If parsing is 92 | successful, pass the obtained data-structure as an item to the 93 | pattern matcher. Only files with an extension from the #jsonl 94 | extension group will be tried, unless overridden by any explicit 95 | extension specification. 96 | 97 | --blame-per-file 98 | 99 | Attempt to obtain "git blame" information of the file as a Git::Blame::File 100 | object. If successful, pass the Git::Blame::File object as an item to 101 | the pattern matcher. Only looks at files that are under version control 102 | (as if --under-version-control has been specified). 103 | 104 | These methods can be called on the object passed to the pattern Callable: 105 | - commits Map of commits, key is SHA1, value if Git::Blame::Commit object 106 | - authors list of unique authors 107 | 108 | These methods can be called on the Git::Blame::Commit object: 109 | - author the name of the author 110 | - author-mail the email address of the author 111 | - author-time a DateTime object for the authoring 112 | - commit the associated Git::Blame::Commit object 113 | - committed whether it has been committed already 114 | - committer the name of the committer 115 | - committer-mail the email address of the committer 116 | - committer-time a DateTime object for the committing 117 | - previous-sha1 the full SHA1 of the previous commit 118 | - previous-sha the shortened SHA1 of the previous commit 119 | - previous-filename the filename in the previous commit 120 | - sha1 full SHA1 of the commit to which this line belongs 121 | - sha shortened SHA1 of the commit to which this line belongs 122 | - summary the first line of the commit message of this line 123 | 124 | Examples: 125 | # produce the committers in a repository 126 | $ rak --blame-per-file '*.authors.Slip' --unique 127 | 128 | # produce files with more than one commit and number of commits 129 | $ rak --blame-per-file '{ .commits.Int if .commits > 1 }' 130 | 131 | Requires that the Git::Blame::File module is installed. 132 | For more information about Git::Blame::File objects, see 133 | https://raku.land/zef:lizmat/Git::Blame::File . 134 | 135 | --blame-per-line 136 | 137 | Attempt to obtain "git blame" information of the file as a Git::Blame::File 138 | object. If successful, produce each line as a Git::Blame::Line item to the 139 | pattern matcher. Only looks at files that are under version control 140 | (as if --under-version-control has been specified). 141 | 142 | Apart from the methods that can be called on the Git::Blame::Commit 143 | object (see above), these additional methods can be called on the object 144 | passed to the pattern matcher: 145 | - commit the associated Git::Blame::Commit object 146 | - filename the current filename 147 | - line the actual line currently 148 | - line-number the current line-number 149 | - original-line-number line number when this line was created 150 | 151 | Requires that the Git::Blame::File module is installed. 152 | For more information about Git::Blame::Line objects, see 153 | https://raku.land/zef:lizmat/Git::Blame::File . 154 | 155 | --csv-per-line 156 | 157 | Attempt to interprete file as a CSV file, and by default pass each row as 158 | a hash to the pattern matcher. Only files with extensions from the #csv group 159 | will be tried, unless overridden by any explicit extension specification. 160 | 161 | The following options only make sense when --csv-per-line has been specified: 162 | - --allow-loose-escapes flag, allow any character to be escaped 163 | - --allow-loose-quotes flag, allow unquoted fields 164 | - --allow-whitespace flag, allow whitespace around separator 165 | - --auto-diag flag, show diagnostics (default: true) 166 | - --eol=[\n|\r|\r\n] different line ending to assume 167 | - --escape=[\\] escape character, default \ (shell requires \\) 168 | - --formula=[type] none | die | diag | empty, default: none 169 | - --quote=["] quoting char, default: " 170 | - --sep=[,] field separator, default: , 171 | - --strict flag, do not allow different number of fields 172 | - --keep-meta flag, produce fields as CSV::Field instead of Str 173 | - --headers[=value] logic for handling headers, see below 174 | 175 | Example: 176 | # Show the values of the column named "foo" of the rows in the "info.csv" 177 | # file if the column named "bar" is equal to "foo" 178 | $ rak --csv-per-line '{. if . eq "foo"}' info.csv 179 | 180 | # Show the values of the first column of the rows in the "info.csv" file 181 | # if the second column is equal to "foo" 182 | $ rak --csv-per-line --/headers '{.[0] if .[1] eq "foo"}' info.csv 183 | 184 | Requires that the Text::CSV module is installed. 185 | For more information about Text::CSV, see 186 | https://raku.land/github:Tux/Text::CSV . 187 | 188 | --headers 189 | 190 | Only applicable when --csv-per-line is also specified. It defaults to 191 | "auto". It can have the following values: 192 | 193 | - True same as "auto" (--headers) 194 | - False assume comma separator and no header line (--/headers) 195 | - auto automatically determine separator, first line is header 196 | - skip skip first line, no key mapping 197 | - uc same as "auto", but uppercase the column names in header 198 | - lc same as "auto", but lowercase the column names in header 199 | - list of column names to assume 200 | - :a, :b map column names to given alternate value 201 | - code Raku code generating any of the above values 202 | 203 | Examples: 204 | # Use uppercase column names 205 | $ rak --csv-per-line --headers=uc '{. if . eq "foo"}' info.csv 206 | 207 | # Use alternate column names in order of columns 208 | $ rak --csv-per-line --headers='' '{. if . eq "foo"}' info.csv 209 | 210 | # Use alternate column names using mapping 211 | $ rak --csv-per-line --headers=':foo, :bar' '{. if . eq "foo"}' info.csv 212 | 213 | --pdf-info 214 | 215 | Attempt to interprete file as a PDF file, and by pass its meta-information 216 | as a single hash to the pattern matcher. Only makes sense if the pattern 217 | is a Callable pattern Only looks at PDF files (as if --is-pdf has been 218 | specified). 219 | 220 | --pdf-per-file 221 | 222 | Attempt to interprete file as a PDF file, and by pass its text as a single 223 | string to the pattern matcher. Only looks at PDF files (as if --is-pdf 224 | has been specified). 225 | 226 | --pdf-per-line 227 | 228 | Attempt to interprete file as a PDF file, and by pass its text contents 229 | as lines to the pattern matcher. Only looks at PDF files (as if 230 | --is-pdf has been specified). 231 | 232 | --mbc 233 | 234 | Attempt to interprete files as a MoarVM bytecode file and pass one 235 | MoarVM::Bytecode object to the pattern matcher for each file. Only looks 236 | at MoarVM bytecode files (as if --is-moarvm has been specified). 237 | 238 | --mbc-frames 239 | 240 | Attempt to interprete files as a MoarVM bytecode file and pass 241 | MoarVM::Bytecode::Frame objects to the pattern matcher. Only looks at 242 | MoarVM bytecode files (as if --is-moarvm has been specified). 243 | 244 | --mbc-strings 245 | 246 | Attempt to interprete files as a MoarVM bytecode file and pass each 247 | string in its string heap to the pattern matcher. Only looks at 248 | MoarVM bytecode files (as if --is-moarvm has been specified). 249 | 250 | --unicode 251 | 252 | Produce the names of all Unicode defined codepoints (built into Raku) 253 | and pass these to the pattern matcher. Shows matched codepoint values 254 | in hexadecimal, the full name and the actual character. 255 | 256 | Example: 257 | # show all codepoints that have "banknote" in their name 258 | $ rak --unicode banknote 259 | 1F4B4 BANKNOTE WITH YEN SIGN 💴 260 | 1F4B5 BANKNOTE WITH DOLLAR SIGN 💵 261 | 1F4B6 BANKNOTE WITH EURO SIGN 💶 262 | 1F4B7 BANKNOTE WITH POUND SIGN 💷 263 | -------------------------------------------------------------------------------- /resources/help/listing.txt: -------------------------------------------------------------------------------- 1 | Listing modifiers: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --absolute 5 | 6 | Indicate that whenever a path is shown, it should be shown as an absolute 7 | path. The default is False, making paths show as relative paths. 8 | 9 | --break[=string] 10 | 11 | String to show between different files. Defaults to "" if a human is 12 | watching, or to no string to show between different files otherwise. 13 | 14 | --file-separator-null 15 | 16 | Only makes sense in combination with --files-with-matches or 17 | --files-without-matches. If specified, will separate filenames 18 | with null bytes, rather than with newlines. Defaults to False. 19 | 20 | --group-matches 21 | 22 | If specified with a true value, then if a file contains matches, will 23 | show the filename on a separate line, otherwise the filename will be 24 | prefixed to any match. Defaults to True if a human is watching, else 25 | False. 26 | 27 | --highlight 28 | 29 | Highlight any matches in strings if the pattern is not a Callable. 30 | Defaults to True if a human is watching, else False. 31 | 32 | --highlight-before=xxx 33 | 34 | Specify the string to put before a match in a string. By default 35 | is the BOLD ON terminal sequence. 36 | 37 | --highlight-after=yyy 38 | 39 | Specify the string to put after a match in a string. Defaults to 40 | either what was specified with --highlight-before, or to BOLD OFF 41 | if that was *not* specified. 42 | 43 | --human 44 | 45 | Force defaults as if a human is watching. Defaults to True if a human 46 | is watching (aka, a terminal is connected to STDOUT, aka $*OUT.t is true). 47 | The following defaults will be applied unless specifically overridden: 48 | 49 | --break="" 50 | --group-matches 51 | --highlight 52 | --trim 53 | --only-first=1000 54 | 55 | --only-first[=N] 56 | 57 | Specify the *total* number of lines that matched, to be shown. Defaults 58 | to 1000 if a human is watching, else no limitation will be applied. If 59 | specified as a flag, assumes 1. 60 | 61 | --output-dir=directory 62 | 63 | Specify the name of the directory to store the results in. For each group, 64 | a separate file will be created. Usually used in conjunction with 65 | --classify or --categorize, but can also be used for normal search results. 66 | In that case, the basename of a file with results will be taken as the name 67 | of the file to create in that output directory. The directory must **not** 68 | exist beforehand. 69 | 70 | --output-file=filename 71 | 72 | Specify the name of the file to store the results in. Defaults to sending 73 | results to STDOUT. 74 | 75 | --pager=program 76 | 77 | Specify a pager program to use. Defaults to what is specified with the 78 | RAK_PAGER environment variable. If that is not specified either, does 79 | not activate any pager. 80 | 81 | --proximate[=N] 82 | 83 | Specify grouping of matched lines by indicating the maximum difference 84 | in line number value that is allowed before an extra empty line will 85 | be added between matches. If specified as a flag, will assume 1. 86 | Defaults to 0 to indicate no proximation. 87 | 88 | --show-blame 89 | 90 | Indicate whether to show blame information if possible (currently only 91 | "git blame" supported). Defaults to False. 92 | 93 | --show-item-number 94 | 95 | Indicate whether to show the item number of an item that matched. 96 | Defaults to True. Some other options may override this, such as 97 | --unique and --frequencies. 98 | 99 | --show-filename 100 | 101 | Indicate whether to show the filename in which a match occurred. 102 | Defaults to True. Some other options may override this, such as 103 | --unique and --frequencies. 104 | 105 | --summary-if-larger-than=N 106 | 107 | Indicate whether a matching line should be summarized if it 108 | exceeds the given number of characters. Defaults to 160. 109 | 110 | --stats 111 | 112 | Indicate to show statistics about the search performed after the 113 | results have been shown. Defaults to False. 114 | 115 | --trim 116 | 117 | Indicate to remove whitespace at the start and the end of a 118 | matching line. Defaults to True if a human is watching. May be 119 | overridden by some options, such as --context. 120 | -------------------------------------------------------------------------------- /resources/help/option.txt: -------------------------------------------------------------------------------- 1 | Option management: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --save=name 5 | 6 | Create a custom option with the name given, of all the other named 7 | arguments specified. The other named arguments may themselves be 8 | shortcuts. 9 | 10 | Examples: 11 | # specify '--rsd' as a shortcut to '--recurse-symlinked-dir" 12 | $ rak --recurse-symlinked-dir --save=rsd 13 | 14 | # specify '--i' as shortcut to '--ignorecase' 15 | $ rak --ignorecase --save=i 16 | 17 | # specify '--m' as shortcut to '--ignoremark' 18 | $ rak --ignoremark --save=m 19 | 20 | # run a search with '--ignorecase' and '--ignoremark' 21 | $ rak -im foo 22 | 23 | # specify '--r' as shortcut to '-im' and '--extensions=#raku' 24 | $ rak -im --extensions=#raku --save=r 25 | 26 | # run a search with --im on files with raku extensions 27 | $ rak -r foo 28 | 29 | One of these other named arguments can be marked as needing to 30 | have a value specified with a single exclamation mark as its value. 31 | 32 | Examples: 33 | # specify '--ex' as a shortcut for '--extensions', requiring a value 34 | $ rak --extensions=! --save=ex 35 | 36 | # run a search on files with raku extensions only 37 | $ rak foo --ex=#raku 38 | 39 | It's also possible for one named argument to have a default value 40 | (that can be overridden) by specifying the default value between 41 | square brackets. 42 | 43 | Examples: 44 | # specify '--x' as a shortcut for --extensions=#raku with override 45 | $ rak --extensions=[#raku] --save=x 46 | 47 | # run a search on files with Raku extensions 48 | $ rak -x foo 49 | 50 | # run a search on files with ".dat" extensions 51 | $ rak -x=dat foo 52 | 53 | To remove a custom option, just specify the --save argument with 54 | the name of the custom option you would like to remove. 55 | 56 | Example: 57 | # Remove the '--ex' custom option 58 | $ rak --save=ex 59 | 60 | --description=text 61 | 62 | Specify a description to be saved with the custom option. This will be 63 | shown prominently with --list-custom-options. If it is the only argument 64 | apart from --save, then the discription will be added (if there was no 65 | description yet) or replace the current description of the option. 66 | 67 | Examples: 68 | # Add description to --i custom option 69 | $ rak --description="Perform search without regards to case" --save=i 70 | 71 | # Add custom option --y with description 72 | $ rak --description='Yep, there is a codepoint for it' --unicode --save=y 73 | 74 | --ack 75 | 76 | Attempt to interpret following arguments as if they were arguments to the 77 | "ack" utility. This is incomplete and may be subtly different in behaviour. 78 | Intended as a temporary measure for people used to using "ack", while they 79 | train their muscle memory to use "rak" instead. 80 | 81 | --list-custom-options 82 | 83 | List all currently known custom options. Must be the only argument, but 84 | can also be used in conjunction with --ack. 85 | -------------------------------------------------------------------------------- /resources/help/pattern.txt: -------------------------------------------------------------------------------- 1 | Pattern specification: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | There are 4 ways in which a primary pattern can be specified: 5 | 6 | 1. As the first positional argument 7 | 2. Or with the --pattern=foo argument 8 | 3. Or with the --not=foo argument 9 | 4. Or using the --patterns-from=file argument 10 | 11 | The first is easiest for a quick ad-hoc search. The second and third can 12 | be handy if you want to create a short-cut to searching for (the absence 13 | of) a particular string with --save. The last one allows you set up a 14 | set of patterns to be searched for simultaneously. 15 | 16 | The --not=foo argument negates the match, so will select items that do 17 | **NOT** match the pattern specification. 18 | 19 | If the --patterns-from=file argument is specified, it will read the content 20 | of the given file and process each line as a pattern specification, as 21 | described below. When searching, each pattern is tried on an item, and 22 | accepted as soon as a pattern matched. Any highlighting will occur on 23 | any of the patterns specified. 24 | 25 | If a literal string is specified as a pattern, then by default any item of 26 | which the stringification contains that string, will be accepted. 27 | 28 | Example: 29 | # produce any lines that have "foo" in them 30 | $ rak foo 31 | 32 | Patterns come in 4 flavours: 33 | 34 | 1. as a literal string 35 | 2. as a regex (the Raku name for "regular expression") 36 | 3. as a piece of code (a Callable in Raku) 37 | 4. as a JSON path expression 38 | 39 | Whether something you specified is interpreted as a regex or as code, or 40 | just as a string, is determined by the --type argument. By default, the 41 | --type arguments assumes "auto". When this is (implicitly) specified, 42 | then the string will be checked for special markers to deduce the intended 43 | type of pattern. 44 | 45 | Regex: 46 | 47 | If a string that starts and ends with '/' is specified as a pattern, 48 | it is considered to be a regex and will be compiled as such. Any 49 | item of which the stringification smart matches with the regex, 50 | will be accepted. See https://docs.raku.org/language/regexes for 51 | more information about Raku regexes. 52 | 53 | Example: 54 | # produce any lines that have the word "bar" in them 55 | $ rak '/ << bar >> /' 56 | 57 | If --type=regex has been specified, you should omit the '/' at either end of 58 | the string: 59 | 60 | Example: 61 | # produce any lines that have the word "bar" in them 62 | $ rak --type=regex '<< bar >>' 63 | 64 | Code: 65 | 66 | If a string that starts with '{' and ends with '}' is specified, or 67 | a string that starts with '*', they will be considered to be Raku 68 | executable code and compiled as such. Each item will be passed as 69 | a positional argument to the compiled code, available in its scope 70 | as the topic (aka $_). To facilitate the use of libraries that wish 71 | to access that topic, it is also available as the $*_ dynamic variable. 72 | 73 | The code is expected to return a value that is: 74 | 75 | 1. True produce item, unless --invert-match was specified 76 | 2. False do **NOT** produce item, unless --invert-match was specified 77 | 3. Empty do **NOT** produce item, unless --invert-match was specified 78 | 4. Nil do **NOT** produce item, unless --invert-match was specified 79 | 5. Slip produce all items in the Slip, always 80 | 6. product produce that, always 81 | 82 | True or False are returned for any condition. 83 | 84 | Empty is returned for any failed conditional construct, such as "if", 85 | "unless", "with" or "without". 86 | 87 | Nil is typically returned when a "try" has failed. 88 | 89 | That last two options are specifically handy when using in conjunction 90 | with the --unique, --frequencies (for getting summaries). And with the 91 | content modification options --modify-files and --rename-files. 92 | 93 | Examples: 94 | # produce any lines that have "foo" in them 95 | $ rak '*.contains("foo")' 96 | 97 | # produce any lines that do **NOT** have "foo" in them 98 | $ rak '*.contains("foo").not' 99 | 100 | # produce uppercased lines 101 | $ rak '*.uc' 102 | 103 | # produce only lines uppercased that have "foo" in them 104 | $ rak '{ .uc if .contains("foo") }' 105 | 106 | # produce all lines, only uppercase the ones that have "rakudoc" in them 107 | $ rak '{.contains("rakudoc") ?? .uc !! $_}' 108 | 109 | # produce all unique words 110 | $ rak '*.words.Slip' 111 | 112 | If --type=code has been specified, you should omit the '{' and '}', or 113 | omit the initial '*'. 114 | 115 | Examples: 116 | # produce uppercased lines 117 | $ rak --type=code .uc 118 | 119 | # produce all lines, only uppercase the ones that have "rakudoc" in them 120 | $ rak --type=code '.contains("rakudoc") ?? .uc !! $_' 121 | 122 | JSON path: 123 | 124 | Interpret the pattern as a JSON path if the pattern begins with 'jp:'. 125 | Only makes sense when used together with --json-per-file, --json-per-line 126 | or --json-per-elem. Requires that the JSON::Path module is installed. 127 | 128 | Examples: 129 | # produce all unique "auth" fields 130 | $ rak --json-per-file --unique jp:auth 131 | 132 | # produce all unique fields in the "tags" array 133 | $ rak --json-per-file --unique 'jp:tags[*]' 134 | 135 | Alternately, one can specify the --type=json-path argument, in which case 136 | the 'jp:' should be omitted: 137 | 138 | Examples: 139 | # produce all unique "auth" fields 140 | $ rak --json-per-file --type=json-path --unique auth 141 | 142 | # produce all unique fields in the "tags" array 143 | $ rak --json-per-file --type=json-path --unique 'tags[*]' 144 | 145 | The following syntax is supported 146 | 147 | $ root node 148 | .key index hash key 149 | ['key'] index hash key 150 | [2] index array element 151 | [0,1] index array slice 152 | [4:5] index array range 153 | [:5] index from the beginning 154 | [-3:] index to the end 155 | .* index all elements 156 | [*] index all elements 157 | [?(expr)] filter on Raku expression 158 | ..key search all descendants for hash key 159 | 160 | A query that is not rooted from $ or specified using .. will be evaluated 161 | from the document root (that is, same as an explicit $ at the start). 162 | 163 | The "jp:path" and "--type=json-path" syntax are actually syntactic sugar 164 | for calling a dedicated "jp" macro that takes a JSON path as its unquoted 165 | argument, and returns an instantiated C object. 166 | 167 | This means that: 168 | 169 | $ rak --json-per-file jp:foo 170 | $ rak --json-per-file --type=json-path foo 171 | 172 | are a different way of saying: 173 | 174 | $ rak --json-per-file '{ jp(foo).Slip }' 175 | 176 | using the "pattern is Raku code" syntax. 177 | 178 | The following methods can be called on the "JP" object: 179 | 180 | .value The first selected value. 181 | .values All selected values as a Seq. 182 | .paths The paths of all selected values as a Seq. 183 | .paths-and-values Interleaved selected paths and values. 184 | 185 | In all other ways, the "JP" object as a a "Seq" object. 186 | 187 | Search types on literal strings: 188 | 189 | Literal strings matching can be further specialized with other values of the 190 | --type argument: 191 | 192 | - contains string must occur anywhere in item 193 | - words string must be surrounded by (virtual) whitespace in item 194 | - starts-with item must *start* with string 195 | - ends-with item must *end* with string 196 | - equal item must be *equal* to string 197 | - split split string on whitespace for separate patterns 198 | 199 | Examples: 200 | # produce any lines that have the word "bar" in them 201 | $ rak --type=words bar 202 | 203 | # produce any lines that start with "Example" 204 | $ rak --type=starts-with Example 205 | 206 | Both literal string matching, as well as matching with a regex, are 207 | sensitive to the --smartcase, --ignorecase and --ignoremark arguments. 208 | 209 | Shortcuts: 210 | 211 | Several shortcuts are available to indicate some type of behaviour for 212 | literal strings. They are 213 | 214 | - string --type=contains string 215 | - §string --type=words string 216 | - ^string --type=starts-with string 217 | - string$ --type=ends-with string 218 | - ^string$ --type=equal string 219 | - !string --type=not 220 | 221 | Examples: 222 | # produce any lines that have the word "bar" in them 223 | $ rak §bar 224 | 225 | # produce any lines that start with "Example" 226 | $ rak ^Example 227 | 228 | Additional patterns: 229 | 230 | You can also specify additional patterns that should also (not) match: 231 | 232 | - --and=bar Must ALSO match anywhere in line 233 | - --andnot=bar Must ALSO NOT match anywhere in line 234 | - --or=bar May ALSO match anywhere in line 235 | - --ornot=bar May ALSO NOT match annywhere in line 236 | 237 | Examples: 238 | # produce any lines that have the words "foo" and "bar" in them 239 | $ rak §foo --and=§bar 240 | 241 | # produce any lines that start with "foo" but not have "bar" in them 242 | $ rak ^foo --andnot=bar 243 | -------------------------------------------------------------------------------- /resources/help/philosophy.txt: -------------------------------------------------------------------------------- 1 | Philosophy: 2 | ‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | The philosophy of "rak" came from having a personal itch for having 5 | "ack" on a newly installed machine, but not wanting to fetch that 6 | from CPAN because, well, it is Perl and I want to move away from it. 7 | 8 | And I missed a number of features in "ack", most notably the 9 | ability to use a search result as direct pointers to places in 10 | files to edit. That is now supplied with the --edit option in 11 | "rak". 12 | 13 | The other thing I missed, was the ability to use Raku regexes 14 | as patterns to search, which is now possible. 15 | 16 | I also always get confused with the myriad of options that you can 17 | specify with programs such as "grep", "ack" or "ag". And "rak" is 18 | no different in that sense. But each option only has a single 19 | "long" spelling, so that should reduce the cognitive load a bit 20 | (although maybe not the typing part). Fortunately, you can create 21 | your *own* shortcuts of often used options with --save! 22 | 23 | The name "rak" developed from "rack", as in: Raku version of 24 | "ack". I decided to drop the "c" to make it more Raku like. 25 | As it turns out, "rak" in Dutch means a straight part of a 26 | river. Which feels oddly appropriate, trying to get to the 27 | heart of things directly. 28 | 29 | At the current stage of development of "rak", it is still 30 | mainly geared towards my personal itch, although several 31 | people have already expressed interest in using it also. 32 | 33 | Performance is important, but does not currently have a 34 | strong focus in development: it is more important to get 35 | things working in a way that is workable for me, and other 36 | explorers of this new tool. 37 | 38 | Elizabeth Mattijsen 39 | -------------------------------------------------------------------------------- /resources/help/resource.txt: -------------------------------------------------------------------------------- 1 | Resource usage: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | By default, "rak" attempts to use all computer's resources as 5 | much as possible. You can tune some of the parameters related 6 | to parallelism of execution. 7 | 8 | --batch[=N] 9 | 10 | Indicate how many files should be processed within a single worker 11 | thread at a time. Defaults to 64 if not specified. When specified 12 | as a flag without any value, will assume the value 1. 13 | 14 | Examples: 15 | # run a search using batches of 1024 files per worker thread 16 | $ rak --batch=1024 foo 17 | 18 | # run a search with each file handled by a separate worker thread 19 | $ rak --batch foo 20 | 21 | --degree[=N | code] 22 | 23 | Indicate how many worker threads should be use maximally (which 24 | usually effectively means the number of CPU cores to be used). 25 | Defaults to the number of CPU cores minus one (with a minimum of 26 | one, obviously). When specified as a flag without any value, 27 | will assume the value 1. When specified with a Callable, will 28 | call that Callable with the total number of CPUs available, 29 | and will use the result as the value to apply. 30 | 31 | Examples: 32 | # run a search on only one worker thread 33 | $ rak --degree foo 34 | 35 | # run a search on maximally 2 worker threads 36 | $ rak --degree=2 foo 37 | 38 | # run a search on half of the CPUs maximally 39 | $ rak --degree='*/2' foo 40 | -------------------------------------------------------------------------------- /resources/help/result.txt: -------------------------------------------------------------------------------- 1 | Result modifiers: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | These options alter the way a search result is processed and shown. 5 | Many combinations of these options may or may not make sense. 6 | 7 | --after-context=N 8 | 9 | Also produce N items after any item with a match. Defaults to *no* 10 | items after any item with a match. 11 | 12 | --also-first=N 13 | 14 | Also produce the first N items if there is an item with a match. 15 | Defaults to *no* items. Assumes 1 if specified as a flag. 16 | 17 | --always-first=N 18 | 19 | Always produce the first N items regardles of whether there is an 20 | item with a match. Defaults to *no* items. Assumes 1 if specified as 21 | a flag. 22 | 23 | --before-context=N 24 | 25 | Also produce N items before any item with a match. Defaults to *no* 26 | items before any item with a match. 27 | 28 | --categorize=categorizer 29 | 30 | If specified, indicates the Callable that should return zero or more 31 | keysfor a given line to have it categorized. This effectively replaces 32 | the filename if a line by its key in the result. See also --classify. 33 | 34 | Example: 35 | # categorize by the first two letters of a line 36 | $ rak --categorize='*.substr(0,2).comb' 37 | 38 | --classify=classifier 39 | 40 | If specified, indicates the Callable that should return a key for a 41 | given line to have it classified. This effectively replaces the filename 42 | if a line by its key in the result. See also --categorize. 43 | 44 | Example: 45 | # classify by the last letter of a line 46 | $ rak --classify='*.substr(*-1)' 47 | 48 | --context=N 49 | 50 | Also produce N items before and after any item with a match. 51 | Defaults to *no* items before or after a match. 52 | 53 | --count-only 54 | 55 | When specified with a true value, will **ONLY** produce result counts. 56 | 57 | --files-with-matches 58 | 59 | Produce only the names of files *with* matches. By default, will 60 | return full result information. 61 | 62 | --files-without-matches 63 | 64 | Produce only the names of files *without* matches. By default, will 65 | return full result information. 66 | 67 | --frequencies 68 | 69 | Create a Bag of the search result and produce the contents of the Bag 70 | in decreasing frequency. Usually used in conjunction with a Callable 71 | pattern that produces a string, or with --matches-only. 72 | 73 | --invert-match 74 | 75 | Invert the meaning of matching, producing items that did *not* match. 76 | 77 | --matches-only 78 | 79 | Only produce the actual matches, instead of the items that matched. 80 | Usually used in conjunction with --unique or --frequencies. 81 | 82 | --max-matches-per-file=N 83 | 84 | Specify the maximum number of matches that should be produced per 85 | file. If not specified, will produce all possible matches of a file. 86 | 87 | --paragraph-context 88 | 89 | Also produce all items before and after any matched item if they are 90 | in the same paragraph. A paragraph being defined as the items between 91 | two items that stringify to the empty string. 92 | 93 | --passthru 94 | 95 | Always produce all items. 96 | 97 | --passthru-context 98 | 99 | Produce all items of a file if there was at least one match. 100 | 101 | --stats-only 102 | 103 | When specified with a true value, will **ONLY** produce statistics. 104 | See also --stats. 105 | 106 | --unique 107 | 108 | Only produce unique items (or whatever a Callable pattern produced) 109 | sorted by foldcase logic. 110 | -------------------------------------------------------------------------------- /resources/help/special.txt: -------------------------------------------------------------------------------- 1 | Special options: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --checkout=string 5 | 6 | Helper function for the busy developer who has a large number of 7 | git branches to handle. Takes the specified string, searches the 8 | available branches in the current directory, and will checkout 9 | the one if there is a single match. Presents the matching branches 10 | if there is more than one. Will checkout branch "main" if "master" 11 | was specified if there is no branch named "master", and vice-versa. 12 | Branches need not have been checked out locally yet. 13 | 14 | --edit[=editor] 15 | 16 | Take the search result as positions in the code to go edit. If no 17 | specific editor is specified, will assume what is specified in the 18 | EDITOR environment variable. If no editor specification can be 19 | found, will assume "vim" as the editor. 20 | 21 | Can be used in conjuction with --find to edit files of which the 22 | name matches the pattern. 23 | 24 | --vimgrep 25 | 26 | Take the search result as positiuons in the code to go edit from 27 | within "vim" using the :vimgrep option. 28 | 29 | --backtrace 30 | 31 | Flag. When specified with a True value, will interpret either standard 32 | input, or a single file, as a Raku backtrace. And produce a result 33 | containing the lines of source code from that backtrace. Can be used 34 | together with --context, --before-context, --after-context, --edit and 35 | --vimgrep. Any pattern specification will only be used for highlighting. 36 | If *not* used in combination with --edit or --vimgrep, will assume a 37 | context of 2 lines. 38 | 39 | Examples: 40 | # look at source of a stacktrace after running script 41 | $ raku script 2>&1 | rak --backtrace 42 | 43 | # inspect the source of a stacktrace in an editor 44 | $ raku script 2>&1 | rak --backtrace --edit 45 | 46 | # inspect a backtrace stored in a file 47 | $ rak --backtrace filename 48 | 49 | --execute-raku[=code] 50 | 51 | Flag or code specification. When specified with a True value, will 52 | use the pattern as the name of a script to execute. If code is specified 53 | will execute that code. If the code consists of "-", then will read code 54 | from STDIN to execute. Any execution error's backtrace will be used 55 | to produce a result with the lines of source code of that backtrace. 56 | Can be used together with --context, --before-context, --after-context, 57 | --edit and --vimgrep. If *not* used in combination with --edit or --vimgrep, 58 | will assume a context of 2 lines. If --verbose is specified, will try to 59 | create an extended (--ll-exception) backtrace. 60 | 61 | Examples: 62 | # look at source of a stacktrace after running script 63 | $ rak --execute-raku script 64 | 65 | # inspect the source of a stacktrace in an editor 66 | $ rak --execute-raku script --edit 67 | 68 | # inspect a backtrace from execution of code read from STDIN 69 | $ cat script | rak --execute-raku=- 70 | 71 | --sourcery 72 | 73 | Mainly intended for Raku Programming Language core developers. 74 | If specified, indicates that the pattern should be interpreted 75 | as code specifying a simple call to a subroutine, or a simple 76 | call to a method, optionally with arguments. The search result 77 | will then contain the source locations of subroutine / method 78 | that is expected to be able to handle that call. Compatible 79 | with the --edit, --vimgrep and the implicit per-line option. 80 | 81 | Example: 82 | # edit the location(s) of the "say" sub handling a single string 83 | $ rak --sourcery 'say "foo"' --edit 84 | -------------------------------------------------------------------------------- /resources/help/string.txt: -------------------------------------------------------------------------------- 1 | String search pattern modifiers: 2 | ‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒‒ 3 | 4 | --ignorecase 5 | 6 | If specified with a True value, will cause the pattern matcher (if 7 | it is *not* a Callable) to ignore the distinction between upper, 8 | lower and title case letters. 9 | 10 | Example: 11 | # search for "foo" without taking case into account 12 | $ rak --ignorecase foo 13 | 14 | --ignoremark 15 | 16 | If specified with a True value, will cause the pattern matcher (if 17 | it is *not* a Callable) to only use the base character, ignoring any 18 | additional marks and/or accents. 19 | 20 | Example: 21 | # search for "foo" without taking accents into account 22 | $ rak --ignoremark foo 23 | 24 | --smartcase 25 | 26 | If specified with a True value, will cause the pattern matcher (if 27 | it is a literal text) to ignore the distinction between upper, 28 | lower and title case letters (like --ignorecase), but only if the 29 | pattern does **NOT** contain any uppercase letters. 30 | 31 | Example: 32 | # search for "foo" without taking case into account 33 | $ rak --smartcase foo 34 | 35 | # search for "Foo" while *still* taking case into account 36 | $ rak --smartcase Foo 37 | 38 | --smartmark 39 | 40 | If specified with a True value, will cause the pattern matcher (if 41 | it is a literal text) to ignore any accents on letters (like --ignormark), 42 | but only if the pattern does **NOT** contain any accented letters. 43 | 44 | Example: 45 | # search for "foo" without taking accents into account 46 | $ rak --smartmark foo 47 | 48 | # search for "Foo" while *still* taking accents into account 49 | $ rak --smartmark fóö 50 | 51 | --type=[auto|contains|words|starts-with|ends-with|equal|regex|code] 52 | 53 | Expects one of the following literal values: 54 | 55 | - auto allow for shortcuts in pattern (default) 56 | - contains accept if literal pattern occurs anywhere 57 | - words accept if literal pattern is on word/non-word boundaries 58 | - starts-with accept if literal pattern is at the start of an item 59 | - ends-with accept if literal pattern is at the end of an item 60 | - equal accept if literal pattern is same as line 61 | - regex accept if pattern as regex matches an item 62 | - code accept if pattern as code produces a result for an item 63 | 64 | Examples: 65 | # search for "foo" anywhere in an item (default case) 66 | $ rak foo 67 | 68 | # search for "foo" anywhere in an item 69 | $ rak --type=contains foo 70 | 71 | # search for "foo" as a word 72 | $ rak --type=words foo 73 | 74 | # search for "foo" at the start of a line 75 | $ rak --type=starts-with foo 76 | 77 | # search for "foo" at the end of a line 78 | $ rak --type=ends-with foo 79 | 80 | # search for lines consisting of "foo" 81 | $ rak --type=equal foo 82 | 83 | # search for /i.e/ in a line 84 | $ rak --type=regex i.e 85 | 86 | # return all lines in uppercase 87 | $ rak --type=code .uc 88 | -------------------------------------------------------------------------------- /run-tests: -------------------------------------------------------------------------------- 1 | unit sub MAIN(:a($author), :i($install)); 2 | 3 | say run(, :out).out.slurp.chomp; 4 | say "Running on $*DISTRO.gist().\n"; 5 | 6 | say "Testing { 7 | "dist.ini".IO.lines.head.substr(7) 8 | }{ 9 | " including author tests" if $author 10 | }"; 11 | 12 | my @failed; 13 | my $done = 0; 14 | 15 | sub process($proc, $filename) { 16 | if $proc { 17 | $proc.out.slurp; 18 | } 19 | else { 20 | @failed.push($filename); 21 | if $proc.out.slurp -> $stdout { 22 | my @lines = $stdout.lines; 23 | with @lines.first( 24 | *.starts-with(" from gen/moar/stage2"),:k) 25 | -> $index { 26 | say @lines[^$index].join("\n"); 27 | } 28 | else { 29 | say $stdout; 30 | } 31 | } 32 | else { 33 | say "No output received, exit-code $proc.exitcode() ($proc.signal()):\n$proc.os-error()"; 34 | } 35 | } 36 | } 37 | 38 | sub install() { 39 | my $zef := $*DISTRO.is-win ?? 'zef.bat' !! 'zef'; 40 | my $proc := run $zef, "install", ".", "--verbose", "--/test", :out,:err,:merge; 41 | process($proc, "*installation*"); 42 | } 43 | 44 | sub test-dir($dir) { 45 | for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort { 46 | say "=== $_"; 47 | my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge; 48 | process($proc, $_); 49 | $done++; 50 | } 51 | } 52 | 53 | test-dir("t"); 54 | test-dir("xt") if $author && "xt".IO.e; 55 | install if $install; 56 | 57 | if @failed { 58 | say "\nFAILED: {+@failed} of $done:"; 59 | say " $_" for @failed; 60 | exit +@failed; 61 | } 62 | 63 | say "\nALL {"$done " if $done > 1}OK"; 64 | 65 | # vim: expandtab shiftwidth=4 66 | -------------------------------------------------------------------------------- /t/01-basic.rakutest: -------------------------------------------------------------------------------- 1 | use Test; 2 | use App::Rak; 3 | 4 | plan 1; 5 | 6 | ok ::('&main'), 'did &main get exported?'; 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /tools/makeOPTIONS.raku: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env raku 2 | 3 | # This script reads the lib/App/Rak.rakumod file, and generates the information 4 | # about supported options, and writes it back to the file. 5 | 6 | # always use highest version of Raku 7 | use v6.*; 8 | 9 | use String::Utils ; 10 | 11 | my $generator = $*PROGRAM-NAME; 12 | my $generated = DateTime.now.gist.subst(/\.\d+/,''); 13 | my $start = '#- start of available options'; 14 | my $end = '#- end of available options'; 15 | 16 | # slurp the whole file and set up writing to it 17 | my $filename = $?FILE.IO.parent.sibling("lib").add("App").add("Rak.rakumod"); 18 | my @lines = $filename.IO.lines; 19 | $*OUT = $filename.IO.open(:w); 20 | 21 | # Find the options 22 | my @options = @lines.map: { 23 | .Str with .match(/ 'my sub option-' <( <-[(]>+ /) 24 | } 25 | 26 | # for all the lines in the source that don't need special handling 27 | while @lines { 28 | my $line := @lines.shift; 29 | 30 | # nothing to do yet 31 | unless $line.starts-with($start) { 32 | say $line; 33 | next; 34 | } 35 | 36 | # found header, check validity and set up mapper 37 | say "$start --------------------------------------------------"; 38 | say "#- Generated on $generated by $generator"; 39 | say "#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE"; 40 | 41 | # skip the old version of the code 42 | while @lines { 43 | last if @lines.shift.starts-with($end); 44 | } 45 | 46 | # spurt the options 47 | say "my str @options = <@options[]>;"; 48 | 49 | # we're done for this role 50 | say "#- PLEASE DON'T CHANGE ANYTHING ABOVE THIS LINE"; 51 | say "$end ----------------------------------------------------"; 52 | } 53 | 54 | # close the file properly 55 | $*OUT.close; 56 | 57 | note "Found @options.elems() options"; 58 | 59 | # vim: expandtab sw=4 60 | -------------------------------------------------------------------------------- /xt/01-simple.rakutest: -------------------------------------------------------------------------------- 1 | BEGIN %*ENV = 1; 2 | use Test; 3 | 4 | %*ENV := $*TMPDIR.add("rak-test-$*PID.json").absolute; 5 | END unlink %*ENV; 6 | 7 | my constant BON = "\e[1m"; # BOLD ON 8 | my constant BOFF = "\e[22m"; # BOLD OFF 9 | 10 | my $dir = $*PROGRAM.parent.sibling("q"); 11 | my $dira = $dir.absolute ~ $*SPEC.dir-sep; 12 | my $rel := $dir.relative ~ $*SPEC.dir-sep; 13 | my $dot = $?FILE.IO.parent.parent; 14 | 15 | my $patterns := $dot.add("patterns"); 16 | my $rak := $dot.add("bin").add("rak").relative; 17 | 18 | my @filenames := ; 19 | my %name2path = @filenames.map: { $_ => $dir.add($_).absolute } 20 | my %path2name = %name2path.kv.reverse; 21 | 22 | my $paths = $dir.sibling("rak-paths"); 23 | $paths.spurt: %name2path{@filenames}.join("\n"); 24 | END $paths.IO.unlink; 25 | 26 | my @targets = @filenames; 27 | @targets[3] = ""; 28 | @targets[6] .= uc; 29 | 30 | # using paths from here on out 31 | $dot .= relative; 32 | $dir .= absolute; 33 | $paths .= absolute; 34 | 35 | my sub query-ok( 36 | *@query, # the actual parameters 37 | :$ok is copy = "", # the expected result 38 | :$head = 1, # whether to do the --only-first test with this number 39 | :$add-paths = True, # add paths specification 40 | :$add-human = True, # add human specification 41 | :$add-degree = True, # add degree specification 42 | :$ERR = "", # expected output on STDERR 43 | :$add-absolute, # add absolute specification 44 | :$todo, # mark tests as todo 45 | ) is test-assertion { 46 | my @args = $*EXECUTABLE.absolute, "-I$dot", $rak, @query.Slip; 47 | @args.push: "--paths-from=$paths" if $add-paths; 48 | @args.push: "--human" if $add-human; 49 | @args.push: "--degree" if $add-degree; 50 | @args.push: "--absolute" if $add-absolute; 51 | $ok .= chomp; 52 | 53 | # Logic to run the query 54 | my sub run-query() { 55 | my $proc := run @args, :out, :err; 56 | my $key = "huh?"; 57 | 58 | todo($todo) if $todo; 59 | is $proc.err.slurp(:close), $ERR, "is '@query[]' STDERR correct?"; 60 | $add-absolute 61 | ?? $proc.out.lines.join("\n") 62 | !! $proc.out.lines.map(*.subst($rel, :g)).join("\n") 63 | } 64 | 65 | # Base query 66 | my $result := run-query; 67 | todo($todo) if $todo; 68 | is $result, $ok, "is '@query[]' result ok?"; 69 | 70 | # If there was a result, try for only the first result 71 | if $ok && $head { 72 | @query.push: '--only-first'; 73 | @args.push: '--only-first'; 74 | my $result := run-query; 75 | todo($todo) if $todo; 76 | is $result, $ok.lines.head($head).join("\n"), 77 | "is '@query[]' result ok?"; 78 | } 79 | } 80 | 81 | # Checks for "ine" 82 | my @ine = ( 83 | , 84 | , 85 | , 86 | , 87 | , 88 | <ïñę --type=ends-with --ignoremark>, 89 | <ÍNĒ --type=ends-with --ignorecase --ignoremark>, 90 | , 91 | , 92 | , 93 | , 94 | , 95 | , 96 | , 97 | , 98 | , 99 | ); 100 | 101 | # Check highlighting as if a human was watching 102 | for @ine { 103 | query-ok .Slip, '--highlight', :head(2), ok => qq:to/OK/; 104 | nine 105 | 10:n{BON}ine{BOFF} 106 | OK 107 | } 108 | 109 | # Check without highlighting 110 | for |@ine, , '^nine$', '^nine', 'nine$', '§nine' { 111 | query-ok .Slip, 112 | <--show-filename --show-item-number --group-matches --/highlight>, 113 | :head(2), ok => q:to/OK/; 114 | nine 115 | 10:nine 116 | OK 117 | } 118 | 119 | # Sure to not produce any matches 120 | for ( 121 | <§ine>, 122 | <^ine>, 123 | <^ine$>, 124 | , 125 | , 126 | , 127 | , 128 | <ÍNĒ --smartmark>, 129 | , 130 | <42>, 131 | ) { 132 | query-ok .Slip, :ok("\n"); 133 | query-ok .Slip, '--highlight', :ok("\n"); 134 | } 135 | 136 | for "six", ('.lc eq "six"', '--type=code') { 137 | query-ok .Slip, 138 | <--smartcase --/group-matches --/show-item-number --/highlight --/break>, 139 | ok => q:to/OK/; 140 | six:SIX 141 | seven:SIX 142 | eight:SIX 143 | nine:SIX 144 | OK 145 | } 146 | 147 | query-ok , :head(2), ok => qq:to/OK/; 148 | seven 149 | 8:{BON}seven{BOFF} 150 | 151 | eight 152 | 8:{BON}seven{BOFF} 153 | 154 | nine 155 | 8:{BON}seven{BOFF} 156 | OK 157 | 158 | query-ok , :add-absolute, :!head, ok => qq:to/OK/; 159 | {$dira}tw{BON}o{BOFF} 160 | {$dira}zer{BON}o{BOFF} 161 | OK 162 | 163 | query-ok q/{.uc if .contains("u")}/, :head(2), ok => q:to/OK/; 164 | four 165 | 5:FOUR 166 | 167 | five 168 | 5:FOUR 169 | 170 | six 171 | 5:FOUR 172 | 173 | seven 174 | 5:FOUR 175 | 176 | eight 177 | 5:FOUR 178 | 179 | nine 180 | 5:FOUR 181 | OK 182 | 183 | query-ok q/.uc if .contains("v")/, <--type=code --/group-matches --/break>, 184 | ok => q:to/OK/; 185 | five:6:FIVE 186 | six:6:FIVE 187 | seven:6:FIVE 188 | seven:8:SEVEN 189 | eight:6:FIVE 190 | eight:8:SEVEN 191 | nine:6:FIVE 192 | nine:8:SEVEN 193 | OK 194 | 195 | query-ok q/{.uc if .contains("v")}/, '--/group-matches', '--break', 196 | ok => q:to/OK/; 197 | five:6:FIVE 198 | 199 | six:6:FIVE 200 | 201 | seven:6:FIVE 202 | seven:8:SEVEN 203 | 204 | eight:6:FIVE 205 | eight:8:SEVEN 206 | 207 | nine:6:FIVE 208 | nine:8:SEVEN 209 | OK 210 | 211 | for , <*.words.Slip> { 212 | query-ok $_, '--frequencies', ok => q:to/OK/; 213 | 10:zero 214 | 9:one 215 | 8:two 216 | 6:four 217 | 5:five 218 | 4:SIX 219 | 3:seven 220 | 2:eight 221 | 1:nine 222 | OK 223 | } 224 | 225 | for <*.defined>, <{$_}> { 226 | query-ok $_, '--frequencies', ok => q:to/OK/; 227 | 10:zero 228 | 9:one 229 | 8:two 230 | 7: 231 | 6:four 232 | 5:five 233 | 4:SIX 234 | 3:seven 235 | 2:eight 236 | 1:nine 237 | OK 238 | } 239 | 240 | for , <*.words.Slip> { 241 | query-ok $_, '--unique', ok => q:to/OK/; 242 | eight 243 | five 244 | four 245 | nine 246 | one 247 | seven 248 | SIX 249 | two 250 | zero 251 | OK 252 | } 253 | 254 | for <*.defined>, <{$_}> { 255 | query-ok $_, '--unique', ok => q:to/OK/; 256 | 257 | eight 258 | five 259 | four 260 | nine 261 | one 262 | seven 263 | SIX 264 | two 265 | zero 266 | OK 267 | } 268 | 269 | query-ok '*.comb.Slip', '--frequencies', ok => q:to/OK/; 270 | 33:e 271 | 33:o 272 | 16:r 273 | 14:n 274 | 11:f 275 | 10:t 276 | 10:z 277 | 8:i 278 | 8:v 279 | 8:w 280 | 6:u 281 | 4:I 282 | 4:S 283 | 4:X 284 | 3:s 285 | 2:g 286 | 2:h 287 | OK 288 | 289 | query-ok 'zero', '--stats-only', :!head, ERR => qq:to/ERR/; 290 | ---------------------- 291 | Statistics for 'zero': 292 | ---------------------- 293 | Number of files: 10 294 | Number of lines: 55 295 | Number of matches: 10 296 | ERR 297 | 298 | query-ok 'zero', '--count-only', :!head, ok => qq:to/OK/; 299 | 10 matches in 10 files 300 | OK 301 | 302 | query-ok 'eight', <--stats --/highlight>, :!head, 303 | ok => qq:to/OK/, ERR => qq:to/ERR/; 304 | eight 305 | 9:eight 306 | 307 | nine 308 | 9:eight 309 | OK 310 | ----------------------- 311 | Statistics for 'eight': 312 | ----------------------- 313 | Number of files: 10 314 | Number of lines: 55 315 | Number of matches: 2 316 | ERR 317 | 318 | my $bon8boff := BON ~ "eight" ~ BOFF; 319 | query-ok 'eight', '--stats', '--highlight', :!head, 320 | ok => qq:to/OK/, ERR => qq:to/ERR/; 321 | eight 322 | 9:$bon8boff 323 | 324 | nine 325 | 9:$bon8boff 326 | OK 327 | ----------------------- 328 | Statistics for 'eight': 329 | ----------------------- 330 | Number of files: 10 331 | Number of lines: 55 332 | Number of matches: 2 333 | ERR 334 | 335 | query-ok 'seven', :head(2), ok => qq:to/OK/; 336 | seven 337 | 8:{BON}seven{BOFF} 338 | 339 | eight 340 | 8:{BON}seven{BOFF} 341 | 342 | nine 343 | 8:{BON}seven{BOFF} 344 | OK 345 | 346 | query-ok , ok => qq:to/OK/; 347 | seven:s{BON}even{BOFF} 348 | 349 | eight:s{BON}even{BOFF} 350 | 351 | nine:s{BON}even{BOFF} 352 | OK 353 | 354 | query-ok , ok => qq:to/OK/; 355 | 8:s{BON}eve{BOFF}n 356 | 357 | 8:s{BON}eve{BOFF}n 358 | 359 | 8:s{BON}eve{BOFF}n 360 | OK 361 | 362 | query-ok , ok => qq:to/OK/; 363 | seven:8:s{BON}ev{BOFF}en 364 | eight:8:s{BON}ev{BOFF}en 365 | nine:8:s{BON}ev{BOFF}en 366 | OK 367 | 368 | query-ok , 369 | ok => q:to/OK/; 370 | se*ven* 371 | 372 | se*ven* 373 | 374 | se*ven* 375 | OK 376 | 377 | query-ok , 378 | ok => q:to/OK/; 379 | 9:*eig##ht 380 | 381 | 9:*eig##ht 382 | OK 383 | 384 | query-ok , :head(4), ok => qq:to/OK/; 385 | seven 386 | 6:five 387 | 7:SIX 388 | 8:{BON}seven{BOFF} 389 | 390 | eight 391 | 6:five 392 | 7:SIX 393 | 8:{BON}seven{BOFF} 394 | 9:eight 395 | 396 | nine 397 | 6:five 398 | 7:SIX 399 | 8:{BON}seven{BOFF} 400 | 9:eight 401 | 10:nine 402 | OK 403 | 404 | query-ok , :head(4), ok => q:to/OK/; 405 | seven 406 | 6:five 407 | 7:SIX 408 | 8:seven 409 | 410 | eight 411 | 6:five 412 | 7:SIX 413 | 8:seven 414 | 415 | nine 416 | 6:five 417 | 7:SIX 418 | 8:seven 419 | OK 420 | 421 | query-ok , :head(2), ok => q:to/OK/; 422 | seven 423 | 8:seven 424 | 425 | eight 426 | 8:seven 427 | 9:eight 428 | 429 | nine 430 | 8:seven 431 | 9:eight 432 | 10:nine 433 | OK 434 | 435 | query-ok , :!head, ok => qq:to/OK/; 436 | nine 437 | 1:zero 438 | 2:one 439 | 3:two 440 | 4: 441 | 5:four 442 | 6:five 443 | 7:SIX 444 | 8:seven 445 | 9:eight 446 | 10:{BON}nine{BOFF} 447 | OK 448 | 449 | query-ok 'zero', q/--filesize=*>30/, :head(2), ok => qq:to/OK/; 450 | seven 451 | 1:{BON}zero{BOFF} 452 | 453 | eight 454 | 1:{BON}zero{BOFF} 455 | 456 | nine 457 | 1:{BON}zero{BOFF} 458 | OK 459 | 460 | my $user := ~$*USER; 461 | my $uid := +$*USER; 462 | for "--user=$user", qq/--user=*eq"$user"/, "--user=$user,$user", 463 | "--uid=$uid", "--uid=*==$uid" { 464 | query-ok '--find', $_, :!head, ok => qq:to/OK/; 465 | eight 466 | five 467 | four 468 | nine 469 | one 470 | seven 471 | six 472 | three 473 | two 474 | zero 475 | OK 476 | } 477 | 478 | for "--user=!$user", qq/--user=*ne"$user"/, "--user=!$user,$user", 479 | "--uid=*!=$uid" { 480 | query-ok '--find', $_, ok => ""; 481 | } 482 | 483 | my $group := ~$*GROUP; 484 | my $gid := +$*GROUP; 485 | for "--group=$group", qq/--group=*eq"$group"/, "--group=$group,$group", 486 | "--gid=$gid", "--gid=*==$gid" { 487 | query-ok '--find', $_, :!head, ok => qq:to/OK/; 488 | eight 489 | five 490 | four 491 | nine 492 | one 493 | seven 494 | six 495 | three 496 | two 497 | zero 498 | OK 499 | } 500 | 501 | for "--group=!$group", qq/--group=*ne"$group"/, "--group=!$group,$group", 502 | "--gid=*!=$gid" { 503 | query-ok '--find', $_, ok => ""; 504 | } 505 | 506 | for , { 507 | query-ok $_, ok => qq:to/OK/; 508 | zero 509 | one 510 | two 511 | three 512 | four 513 | five 514 | six 515 | seven 516 | eight 517 | nine 518 | OK 519 | } 520 | 521 | query-ok 'zero', '--files-with-matches', '--count-only', :!head, 522 | ok => '10 files with matches'; 523 | query-ok 'null', '--files-without-matches', '--count-only', :!head, 524 | ok => '10 files without matches'; 525 | 526 | for ( 527 | , 528 | , 529 | ) { 530 | query-ok $_, :!head, 531 | ok => "zero\0one\0two\0three\0four\0five\0six\0seven\0eight\0nine"; 532 | } 533 | 534 | for '--per-file', q/--per-file=*.slurp/ { 535 | query-ok , $_, :!head, ok => qq:to/OK/; 536 | nine:zero 537 | one 538 | two 539 | 540 | four 541 | five 542 | SIX 543 | seven 544 | eight 545 | {BON}nine{BOFF} 546 | OK 547 | } 548 | 549 | for '--per-file', q/--per-file=*.slurp/ { 550 | query-ok '/ \w* v \w* /', $_, '--matches-only', :head(2), ok => q:to/OK/; 551 | five 552 | five 553 | 554 | six 555 | five 556 | 557 | seven 558 | five 559 | seven 560 | 561 | eight 562 | five 563 | seven 564 | 565 | nine 566 | five 567 | seven 568 | OK 569 | } 570 | 571 | for '--per-file', q/--per-file=*.slurp/ { 572 | query-ok '/ \w* v \w* /', $_, '--matches-only', '--unique', ok => q:to/OK/; 573 | five 574 | seven 575 | OK 576 | } 577 | 578 | for '--per-file', q/--per-file=*.slurp/ { 579 | query-ok '/ \w* v \w* /', $_, '--matches-only', '--frequencies', 580 | ok => q:to/OK/; 581 | 5:five 582 | 3:seven 583 | OK 584 | } 585 | 586 | query-ok , :head(2), ok => qq:to/OK/; 587 | zero 588 | 1:zer{BON}o{BOFF} 589 | 590 | one 591 | 1:zer{BON}o{BOFF} 592 | 2:{BON}o{BOFF}ne 593 | 594 | two 595 | 1:zer{BON}o{BOFF} 596 | 2:{BON}o{BOFF}ne 597 | 598 | three 599 | 1:zer{BON}o{BOFF} 600 | 2:{BON}o{BOFF}ne 601 | 602 | four 603 | 1:zer{BON}o{BOFF} 604 | 2:{BON}o{BOFF}ne 605 | 606 | five 607 | 1:zer{BON}o{BOFF} 608 | 2:{BON}o{BOFF}ne 609 | 610 | six 611 | 1:zer{BON}o{BOFF} 612 | 2:{BON}o{BOFF}ne 613 | 614 | seven 615 | 1:zer{BON}o{BOFF} 616 | 2:{BON}o{BOFF}ne 617 | 618 | eight 619 | 1:zer{BON}o{BOFF} 620 | 2:{BON}o{BOFF}ne 621 | 622 | nine 623 | 1:zer{BON}o{BOFF} 624 | 2:{BON}o{BOFF}ne 625 | OK 626 | 627 | query-ok <--unicode banknote>, :!add-paths, ok => qq:to/OK/; 628 | 1F4B4 {BON}BANKNOTE{BOFF} WITH YEN SIGN 💴 629 | 1F4B5 {BON}BANKNOTE{BOFF} WITH DOLLAR SIGN 💵 630 | 1F4B6 {BON}BANKNOTE{BOFF} WITH EURO SIGN 💶 631 | 1F4B7 {BON}BANKNOTE{BOFF} WITH POUND SIGN 💷 632 | OK 633 | 634 | query-ok '{ .comb(2).Slip if $_ eq "nine" }', :!head, ok => q:to/OK/; 635 | nine 636 | 10:ni 637 | 10:ne 638 | OK 639 | 640 | # This check is a little brittle 641 | query-ok '--eco-meta', q/{ . eq "eigenstates" && . }/, 642 | :!add-paths, ok => q:to/OK/; 643 | 0.0.11 644 | 0.0.10 645 | 0.0.9 646 | 0.0.8 647 | 0.0.7 648 | 0.0.6 649 | 0.0.5 650 | 0.0.4 651 | 0.0.3 652 | 0.0.2 653 | 0.0.1 654 | OK 655 | 656 | # This check is a little brittle 657 | query-ok '--eco-meta=fez', q/{ . eq "eigenstates" && . }/, 658 | :todo, 659 | :!add-paths, ok => q:to/OK/; 660 | 0.0.6 661 | 0.0.7 662 | 0.0.8 663 | 0.0.9 664 | 0.0.10 665 | 0.0.11 666 | OK 667 | 668 | # This check is a little brittle 669 | query-ok '--sourcery', 'say "foo"', <--/show-item-number --/show-filename>, 670 | ok => 'multi ' ~ BON ~ 'sub say' ~ BOFF ~ '(\x) {' ~ "\n" 671 | ~ 'multi ' ~ BON ~ 'sub say' ~ BOFF ~ '(|) {'; 672 | 673 | # This check is a little brittle 674 | query-ok '--json-per-elem', q/{ . if . eq 'eigenstates' }/, 675 | :todo, 676 | , :!add-paths, :head(2), ok => q:to/OK/; 677 | https://360.zef.pm 678 | 0.0.6 679 | 0.0.7 680 | 0.0.8 681 | 0.0.9 682 | 0.0.10 683 | 0.0.11 684 | OK 685 | 686 | query-ok '*.substr(0,1) eq "f"', '--classify=*.substr(0,1)', :head(2), 687 | ok => q:to/OK/; 688 | f 689 | four 690 | four 691 | five 692 | four 693 | five 694 | four 695 | five 696 | four 697 | five 698 | four 699 | five 700 | OK 701 | 702 | query-ok '*.chars == 5', '--categorize={ .substr(0,2).comb if $_ }', :head(2), 703 | ok => q:to/OK/; 704 | e 705 | seven 706 | seven 707 | eight 708 | seven 709 | eight 710 | 711 | s 712 | seven 713 | seven 714 | seven 715 | 716 | i 717 | eight 718 | eight 719 | OK 720 | 721 | query-ok <--ignorecase --save=i>, :!add-paths, :!add-human, :!add-degree, 722 | :!head, ok => qq:to/OK/; 723 | Saved '--ignorecase' as: -i 724 | OK 725 | 726 | query-ok <--ignoremark --save=m>, :!add-paths, :!add-human, :!add-degree, 727 | :!head, ok => qq:to/OK/; 728 | Saved '--ignoremark' as: -m 729 | OK 730 | 731 | query-ok <-im --list-expanded-options>, :!add-paths, :!add-human, :!add-degree, 732 | :!head, ok => qq:to/OK/; 733 | --ignorecase --ignoremark 734 | OK 735 | 736 | query-ok <--before-context=! --save=B>, :!add-paths, :!add-human, :!add-degree, 737 | :!head, ok => qq:to/OK/; 738 | Saved '--before-context=!' as: -B 739 | OK 740 | 741 | query-ok <--context=[2] --save=C>, :!add-paths, :!add-human, :!add-degree, 742 | :!head, ok => qq:to/OK/; 743 | Saved '--context=[2]' as: -C 744 | OK 745 | 746 | query-ok <--smartcase --save=(default)>, :!add-paths, :!add-human, :!add-degree, 747 | :!head, ok => qq:to/OK/; 748 | Saved '--smartcase' as: (default) 749 | OK 750 | 751 | query-ok <--list-custom-options>, :!add-paths, :!add-human, :!add-degree, 752 | :!head, ok => qq:to/OK/; 753 | (default): --smartcase 754 | -B: --before-context=! 755 | -C: --context=[2] 756 | -i: --ignorecase 757 | -m: --ignoremark 758 | OK 759 | 760 | query-ok <--list-expanded-options>, :!add-paths, :!add-human, :!add-degree, 761 | :!head, ok => qq:to/OK/; 762 | --smartcase 763 | OK 764 | 765 | query-ok <--save=(default)>, :!add-paths, :!add-human, :!add-degree, 766 | :!head, ok => qq:to/OK/; 767 | Removed custom option '(default)' 768 | OK 769 | 770 | query-ok <--list-custom-options>, :!add-paths, :!add-human, :!add-degree, 771 | :!head, ok => qq:to/OK/; 772 | -B: --before-context=! 773 | -C: --context=[2] 774 | -i: --ignorecase 775 | -m: --ignoremark 776 | OK 777 | 778 | query-ok <-/im --list-expanded-options>, :!add-paths, :!add-human, :!add-degree, 779 | :!head, ok => qq:to/OK/; 780 | No options found 781 | OK 782 | 783 | query-ok <*@ --type=starts-with q>, :!add-paths, :!head, ok => qq:to/OK/; 784 | foo 785 | 1:{BON}*\@{BOFF}foo 786 | OK 787 | 788 | query-ok "--patterns-from=$patterns.relative()", :!head, ok => qq:to/OK/; 789 | eight 790 | 9:{BON}eight{BOFF} 791 | 792 | nine 793 | 9:{BON}eight{BOFF} 794 | 10:{BON}nine{BOFF} 795 | OK 796 | 797 | query-ok , :head(2), ok => qq:to/OK/; 798 | seven 799 | 8:se{BON}v{BOFF}e{BON}n{BOFF} 800 | 801 | eight 802 | 8:se{BON}v{BOFF}e{BON}n{BOFF} 803 | 804 | nine 805 | 8:se{BON}v{BOFF}e{BON}n{BOFF} 806 | OK 807 | 808 | query-ok , :head(2), ok => qq:to/OK/; 809 | five 810 | 6:fi{BON}v{BOFF}e 811 | 812 | six 813 | 6:fi{BON}v{BOFF}e 814 | 7:SI{BON}X{BOFF} 815 | 816 | seven 817 | 6:fi{BON}v{BOFF}e 818 | 7:SI{BON}X{BOFF} 819 | 8:se{BON}v{BOFF}en 820 | 821 | eight 822 | 6:fi{BON}v{BOFF}e 823 | 7:SI{BON}X{BOFF} 824 | 8:se{BON}v{BOFF}en 825 | 826 | nine 827 | 6:fi{BON}v{BOFF}e 828 | 7:SI{BON}X{BOFF} 829 | 8:se{BON}v{BOFF}en 830 | OK 831 | 832 | query-ok <--not=e --andnot=o --andnot=^$>, :head(2), ok => qq:to/OK/; 833 | six 834 | 7:SIX 835 | 836 | seven 837 | 7:SIX 838 | 839 | eight 840 | 7:SIX 841 | 842 | nine 843 | 7:SIX 844 | OK 845 | 846 | query-ok <--per-paragraph five --and=nine>, :!head, ok => qq:to/OK/; 847 | nine 848 | 5:four 849 | {BON}five{BOFF} 850 | SIX 851 | seven 852 | eight 853 | {BON}nine{BOFF} 854 | OK 855 | 856 | query-ok , ok => qq:to/OK/; 857 | e 858 | f 859 | g 860 | h 861 | i 862 | I 863 | n 864 | o 865 | r 866 | S 867 | s 868 | t 869 | u 870 | v 871 | w 872 | X 873 | z 874 | OK 875 | 876 | query-ok , ok => qq:to/OK/; 877 | 9 878 | OK 879 | 880 | query-ok , ok => qq:to/OK/; 881 | 17 882 | OK 883 | 884 | query-ok , ok => qq:to/OK/; 885 | 17 unique occurrences in 10 files 886 | OK 887 | 888 | query-ok , :!head, ok => qq:to/OK/; 889 | eight 890 | 1:zero 891 | 9:{BON}eight{BOFF} 892 | 893 | nine 894 | 1:zero 895 | 9:{BON}eight{BOFF} 896 | OK 897 | 898 | query-ok , :!head, ok => qq:to/OK/; 899 | eight 900 | 1:zero 901 | 2:one 902 | 3:two 903 | 9:{BON}eight{BOFF} 904 | 905 | nine 906 | 1:zero 907 | 2:one 908 | 3:two 909 | 9:{BON}eight{BOFF} 910 | OK 911 | 912 | query-ok , :!head, ok => qq:to/OK/; 913 | zero 914 | 1:zero 915 | 916 | one 917 | 1:zero 918 | 919 | two 920 | 1:zero 921 | 922 | three 923 | 1:zero 924 | 925 | four 926 | 1:zero 927 | 928 | five 929 | 1:zero 930 | 931 | six 932 | 1:zero 933 | 934 | seven 935 | 1:zero 936 | 937 | eight 938 | 1:zero 939 | 9:{BON}eight{BOFF} 940 | 941 | nine 942 | 1:zero 943 | 9:{BON}eight{BOFF} 944 | OK 945 | 946 | query-ok , :!head, ok => qq:to/OK/; 947 | zero 948 | 1:zero 949 | 950 | one 951 | 1:zero 952 | 2:one 953 | 954 | two 955 | 1:zero 956 | 2:one 957 | 958 | three 959 | 1:zero 960 | 2:one 961 | 962 | four 963 | 1:zero 964 | 2:one 965 | 966 | five 967 | 1:zero 968 | 2:one 969 | 970 | six 971 | 1:zero 972 | 2:one 973 | 974 | seven 975 | 1:zero 976 | 2:one 977 | 978 | eight 979 | 1:zero 980 | 2:one 981 | 9:{BON}eight{BOFF} 982 | 983 | nine 984 | 1:zero 985 | 2:one 986 | 9:{BON}eight{BOFF} 987 | OK 988 | 989 | done-testing; 990 | 991 | # vim: expandtab shiftwidth=4 992 | -------------------------------------------------------------------------------- /xt/02-csv.rakutest: -------------------------------------------------------------------------------- 1 | BEGIN %*ENV = 1; 2 | use Test; 3 | 4 | my $dir = $*PROGRAM.parent.sibling("csv"); 5 | my $dira = $dir.absolute ~ $*SPEC.dir-sep; 6 | my $rel := $dir.relative ~ $*SPEC.dir-sep; 7 | my $dot = $?FILE.IO.parent.parent; 8 | my $rak := $dot.add("bin").add("rak").relative; 9 | 10 | # using paths from here on out 11 | $dot .= relative; 12 | $dir .= absolute; 13 | 14 | my sub query-ok( 15 | *@query, # the actual parameters 16 | :$ok is copy, # the expected result 17 | :$head = 1, # whether to do the --only-first test with this number 18 | :$add-degree = True, # add degree specification 19 | :$add-human = True, # add human specification 20 | ) is test-assertion { 21 | my @args = $*EXECUTABLE.absolute, "-I$dot", $rak, @query.Slip; 22 | @args.push: "--degree" if $add-degree; 23 | @args.push: "--human" if $add-human; 24 | $ok .= chomp; 25 | 26 | # Logic to run the query 27 | my sub run-query() { 28 | my $proc := run @args, :out, :err; 29 | my $key = "huh?"; 30 | 31 | is $proc.err.slurp(:close), "", "is '@query[]' STDERR clean?"; 32 | $proc.out.lines.map(*.subst($rel, :g)).join("\n") 33 | } 34 | 35 | # Base query 36 | is run-query, $ok, "is '@query[]' result ok?"; 37 | } 38 | 39 | query-ok <--csv-per-line {.} csv/comma.csv>, ok => qq:to/OK/; 40 | 1:1 41 | 2:4 42 | 3:1 43 | OK 44 | 45 | query-ok <--csv-per-line {.[0]} csv/noheader.csv --/headers>, 46 | ok => qq:to/OK/; 47 | 1:1 48 | 2:4 49 | 3:1 50 | OK 51 | 52 | query-ok <--csv-per-line {.values.Slip} csv --frequencies>, ok => qq:to/OK/; 53 | 5:1 54 | 5:2 55 | 5:3 56 | 5:4 57 | 3:5 58 | 3:6 59 | 3:7 60 | 3:8 61 | OK 62 | 63 | done-testing; 64 | 65 | # vim: expandtab shiftwidth=4 66 | -------------------------------------------------------------------------------- /xt/03-json.rakutest: -------------------------------------------------------------------------------- 1 | BEGIN %*ENV = 1; 2 | use Test; 3 | 4 | plan 10; 5 | 6 | my $dir = $*PROGRAM.parent; 7 | my $dira = $dir.absolute ~ $*SPEC.dir-sep; 8 | my $rel := $dir.relative ~ $*SPEC.dir-sep; 9 | my $dot = $?FILE.IO.parent.parent; 10 | my $rak := $dot.add("bin").add("rak").relative; 11 | 12 | # using paths from here on out 13 | $dot .= relative; 14 | $dir .= absolute; 15 | 16 | my sub query-ok( 17 | *@query, # the actual parameters 18 | :$ok is copy, # the expected result 19 | :$head = 1, # whether to do the --only-first test with this number 20 | :$add-human = True, # add human specification 21 | ) is test-assertion { 22 | my @args = $*EXECUTABLE.absolute, "-I$dot", $rak, @query.Slip; 23 | @args.push: "--human" if $add-human; 24 | $ok .= chomp; 25 | 26 | # Logic to run the query 27 | my sub run-query() { 28 | my $proc := run @args, :out, :err; 29 | my $key = "huh?"; 30 | 31 | is $proc.err.slurp(:close), "", "is '@query[]' STDERR clean?"; 32 | $proc.out.lines.map(*.subst($rel, :g)).join("\n") 33 | } 34 | 35 | # Base query 36 | is run-query, $ok, "is '@query[]' result ok?"; 37 | } 38 | 39 | query-ok <--json-per-file jp:auth --/dir>, ok => qq:to/OK/; 40 | META6.json 41 | zef:lizmat 42 | OK 43 | 44 | query-ok <--json-per-file authors --type=json-path --/dir>, ok => qq:to/OK/; 45 | META6.json 46 | Elizabeth Mattijsen 47 | OK 48 | 49 | query-ok <--json-per-file {~jp('license')} --/dir>, ok => qq:to/OK/; 50 | META6.json 51 | Artistic-2.0 52 | OK 53 | 54 | query-ok '--json-per-file', '--/dir', 55 | Q/{~jp('name') if jp('auth') eq "zef:lizmat"}/, ok => qq:to/OK/; 56 | META6.json 57 | App::Rak 58 | OK 59 | 60 | query-ok <--json-per-file {|jp('tags[*]')} --/dir>, ok => qq:to/OK/; 61 | META6.json 62 | ACK 63 | SEARCH 64 | TEXT 65 | EDITOR 66 | FIND 67 | JSON 68 | BLAME 69 | CSV 70 | GIT 71 | OK 72 | 73 | # vim: expandtab shiftwidth=4 74 | -------------------------------------------------------------------------------- /xt/04-pdf.rakutest: -------------------------------------------------------------------------------- 1 | BEGIN %*ENV = 1; 2 | use Test; 3 | 4 | plan 6; 5 | 6 | my $dir = $*PROGRAM.parent; 7 | my $dira = $dir.absolute ~ $*SPEC.dir-sep; 8 | my $rel := $dir.relative ~ $*SPEC.dir-sep; 9 | my $dot = $?FILE.IO.parent.parent; 10 | my $rak := $dot.add("bin").add("rak").relative; 11 | 12 | # using paths from here on out 13 | $dot .= relative; 14 | $dir .= absolute; 15 | 16 | my sub query-ok( 17 | *@query, # the actual parameters 18 | :$ok is copy, # the expected result 19 | :$head = 1, # whether to do the --only-first test with this number 20 | :$add-human = True, # add human specification 21 | ) is test-assertion { 22 | my @args = $*EXECUTABLE.absolute, "-I$dot", $rak, @query.Slip; 23 | @args.push: "--human" if $add-human; 24 | $ok .= chomp; 25 | 26 | # Logic to run the query 27 | my sub run-query() { 28 | my $proc := run @args, :out, :err; 29 | my $key = "huh?"; 30 | 31 | is $proc.err.slurp(:close), "", "is '@query[]' STDERR clean?"; 32 | $proc.out.lines.map(*.subst($rel, :g)).join("\n") 33 | } 34 | 35 | # Base query 36 | is run-query, $ok, "is '@query[]' result ok?"; 37 | } 38 | 39 | query-ok '--pdf-info', Q/*./, 'pdf', ok => qq:to/OK/; 40 | pdf/basic.pdf 41 | Philip Hutchison 42 | OK 43 | 44 | query-ok <--pdf-per-line varius pdf --/highlight>, ok => qq:to/OK/; 45 | pdf/basic.pdf 46 | 8:erat dolor, blandit in, rutrum quis, semper pulvinar, enim. Nullam varius congue risus. 47 | 24:varius. Donec lacinia, neque a luctus aliquet, pede massa imperdiet ante, at varius lorem 48 | 33:penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus varius. Ut sit 49 | 34:amet diam suscipit mauris ornare aliquam. Sed varius. Duis arcu. Etiam tristique massa 50 | OK 51 | 52 | query-ok <--pdf-per-file /eget.pharetra/ pdf --matches-only>, ok => qq:to/OK/; 53 | pdf/basic.pdf 54 | eget 55 | pharetra 56 | OK 57 | 58 | # vim: expandtab shiftwidth=4 59 | -------------------------------------------------------------------------------- /xt/05-mbc.rakutest: -------------------------------------------------------------------------------- 1 | BEGIN %*ENV = 1; 2 | use Test; 3 | 4 | plan 4; 5 | 6 | my $dir = $*PROGRAM.parent; 7 | my $dira = $dir.absolute ~ $*SPEC.dir-sep; 8 | my $rel := $dir.relative ~ $*SPEC.dir-sep; 9 | my $dot = $?FILE.IO.parent.parent; 10 | my $rak := $dot.add("bin").add("rak").relative; 11 | 12 | # using paths from here on out 13 | $dot .= relative; 14 | $dir .= absolute; 15 | 16 | my sub query-ok( 17 | *@query, # the actual parameters 18 | :$ok is copy, # the expected result 19 | :$head = 1, # whether to do the --only-first test with this number 20 | :$add-human = True, # add human specification 21 | ) is test-assertion { 22 | my @args = $*EXECUTABLE.absolute, "-I$dot", $rak, @query.Slip; 23 | @args.push: "--human" if $add-human; 24 | $ok .= chomp; 25 | 26 | # Logic to run the query 27 | my sub run-query() { 28 | my $proc := run @args, :out, :err; 29 | my $key = "huh?"; 30 | 31 | is $proc.err.slurp(:close), "", "is '@query[]' STDERR clean?"; 32 | $proc.out.lines.map(*.subst($rel, :g)).join("\n") 33 | } 34 | 35 | # Base query 36 | is run-query, $ok, "is '@query[]' result ok?"; 37 | } 38 | 39 | query-ok '--mbc-frames', Q/*.name/, 'mbc', '--unique', ok => qq:to/OK/; 40 | 41 | 42 | 43 | 44 | 45 | eigenstates 46 | OK 47 | 48 | query-ok <--mbc-strings distribution mbc --/highlight>, ok => qq:to/OK/; 49 | mbc/eigenstates.mbc 50 | 55:The eigenstates distribution exports a single subroutine called 51 | OK 52 | 53 | # vim: expandtab shiftwidth=4 54 | -------------------------------------------------------------------------------- /xt/coverage.rakutest: -------------------------------------------------------------------------------- 1 | use Test::Coverage; 2 | 3 | plan 2; 4 | 5 | todo "needs more tests"; 6 | coverage-at-least 75; 7 | 8 | todo "needs more tests"; 9 | uncovered-at-most 1; 10 | 11 | source-with-coverage; 12 | 13 | report; 14 | 15 | # vim: expandtab shiftwidth=4 16 | --------------------------------------------------------------------------------