mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
dirname: Add support for multiple paths
This commit is contained in:
parent
828caf12a6
commit
e259c3b38a
1 changed files with 5 additions and 3 deletions
|
@ -12,13 +12,15 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
bool null_terminated = false;
|
||||
DeprecatedString path;
|
||||
Vector<DeprecatedString> paths;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(null_terminated, "End each output line with \\0, rather than \\n", "zero", 'z');
|
||||
args_parser.add_positional_argument(path, "Path", "path");
|
||||
args_parser.add_positional_argument(paths, "Path", "path");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto const delimiter = null_terminated ? '\0' : '\n';
|
||||
out("{}{}", LexicalPath::dirname(path), delimiter);
|
||||
for (auto const& path : paths)
|
||||
out("{}{}", LexicalPath::dirname(path), delimiter);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue