mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
grep: Add comment describing why we take leading characters from paths
This commit is contained in:
parent
3fb406b97e
commit
e48b9d74ac
1 changed files with 2 additions and 1 deletions
|
@ -254,7 +254,8 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
while (it.has_next()) {
|
||||
auto path = it.next_full_path();
|
||||
if (!FileSystem::is_directory(path)) {
|
||||
auto key = user_has_specified_files ? path.view() : path.substring_view(base.length() + 1, path.length() - base.length() - 1);
|
||||
// Remove leading './' when `grep -r` was run without any specified paths.
|
||||
auto key = user_has_specified_files ? path.view() : path.substring_view(base.length() + 1);
|
||||
if (auto result = handle_file(key, true); result.is_error() && !suppress_errors)
|
||||
warnln("Failed with file {}: {}", key, result.release_error());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue