diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-02-17 12:34:42 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-02-17 12:34:42 -0800 |
| commit | da2955f95e968d80daddee0a2f6cf5f512160c10 (patch) | |
| tree | 9fd95cb49a6e03cb35a11bbbca14bfdebe63bba8 | |
| parent | 86c477343d8ae84fc99014a2cc4f844e9c688b9c (diff) | |
Updated search tool to dedent
| -rwxr-xr-x | lib/tools/find.nom | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/tools/find.nom b/lib/tools/find.nom index 3e26ef4..bfd4583 100755 --- a/lib/tools/find.nom +++ b/lib/tools/find.nom @@ -80,11 +80,16 @@ command line program with $args: for $t in recursive $tree: if ($t matches $pattern_tree): $line_num = ($file, line number at $t.source.start) + + $source = (source lines of $t) + $indent = ($source, matching "^ *") + $source = ($source, from (#$indent + 1), with "\n\$indent" -> "\n") + $results, add { .line = $line_num .text = (" \(blue "\$filename:\$line_num:") - \(source lines of $t) + \$source ") } @@ -98,4 +103,4 @@ command line program with $args: ..else: sort $results by $ -> $.line for $ in $results: - say $.text
\ No newline at end of file + say $.text |
