-
Notifications
You must be signed in to change notification settings - Fork 69
add find tool formatters #1020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 07-02/pi-tool-formatter-grep
Are you sure you want to change the base?
add find tool formatters #1020
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,6 +152,24 @@ def format_grep | |
| ok_line("#{count} #{"match".pluralize(count)}", note) | ||
| end | ||
|
|
||
| # Formats a find tool result. | ||
| # | ||
| # Content: matching paths, one per line. | ||
| # | ||
| # Output: "FIND OK <n> <path|paths>" – <n> is the number of non-blank | ||
| # lines (pluralized). | ||
| # | ||
| # Examples: | ||
| # FIND OK 12 paths | ||
| # FIND OK 1 path | ||
| # FIND OK 0 paths | ||
| # | ||
| #: () -> String | ||
| def format_find | ||
| count = content.to_s.lines.map(&:strip).reject(&:empty?).length | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing NOTE handling for status/truncation messages. |
||
| ok_line("#{count} #{"path".pluralize(count)}") | ||
| end | ||
|
|
||
| # Formats a result for which Roast has no dedicated formatter. | ||
| # | ||
| # Content: the tool's output text. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.