mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
dirname: Add support for multiple paths
This commit is contained in:
parent
828caf12a6
commit
e259c3b38a
Notes:
sideshowbarker
2024-07-16 23:55:09 +09:00
Author: https://github.com/tcl3
Commit: e259c3b38a
Pull-request: https://github.com/SerenityOS/serenity/pull/19564
Reviewed-by: https://github.com/gmta ✅
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