mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:37:35 +00:00
ls: ls will print directory name when listing multiple directories
This commit is contained in:
parent
433a23cfde
commit
fe8cefa7c1
1 changed files with 14 additions and 0 deletions
|
@ -145,8 +145,22 @@ int main(int argc, char** argv)
|
||||||
} else if (paths.size() == 1) {
|
} else if (paths.size() == 1) {
|
||||||
status = do_file_system_object(paths[0]);
|
status = do_file_system_object(paths[0]);
|
||||||
} else {
|
} else {
|
||||||
|
Vector<const char*> exists;
|
||||||
for (auto& path : paths) {
|
for (auto& path : paths) {
|
||||||
|
if (Core::File::exists(path)) {
|
||||||
|
exists.append(path);
|
||||||
|
} else {
|
||||||
|
status = do_file_system_object(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < exists.size(); ++i) {
|
||||||
|
auto path = exists.at(i);
|
||||||
|
printf("%s:\n", path);
|
||||||
status = do_file_system_object(path);
|
status = do_file_system_object(path);
|
||||||
|
|
||||||
|
if (i + 1 == exists.size() - 1) {
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue