Return a styled message suitable for progress display when processing a path for an `item` tuple of (location, rid, scan_errors, *other items)
(item, verbose=False, prefix="Scanned: ")
| 392 | |
| 393 | |
| 394 | def path_progress_message(item, verbose=False, prefix="Scanned: "): |
| 395 | """ |
| 396 | Return a styled message suitable for progress display when processing a path |
| 397 | for an `item` tuple of (location, rid, scan_errors, *other items) |
| 398 | """ |
| 399 | if not item: |
| 400 | return "" |
| 401 | location = item[0] |
| 402 | errors = item[2] |
| 403 | location = toascii(location) |
| 404 | progress_line = location |
| 405 | if not verbose: |
| 406 | max_file_name_len = file_name_max_len() |
| 407 | # do not display a file name in progress bar if there is no space available |
| 408 | if max_file_name_len <= 10: |
| 409 | return "" |
| 410 | progress_line = fixed_width_file_name(location, max_file_name_len) |
| 411 | |
| 412 | color = "red" if errors else "green" |
| 413 | return style(prefix) + style(progress_line, fg=color) |
| 414 | |
| 415 | |
| 416 | # CLI help groups |
nothing calls this directly
no test coverage detected