mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
UE: Use Vector<String> for the command-line arguments
Core::ArgsParser gained support for String a while ago. So let's use that.
This commit is contained in:
parent
c2d9cd8d53
commit
26e711f953
Notes:
sideshowbarker
2024-07-18 17:56:08 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/26e711f9534 Pull-request: https://github.com/SerenityOS/serenity/pull/7211 Reviewed-by: https://github.com/awesomekling
1 changed files with 4 additions and 9 deletions
|
@ -19,27 +19,22 @@ bool g_report_to_debug = false;
|
|||
|
||||
int main(int argc, char** argv, char** env)
|
||||
{
|
||||
Vector<const char*> command;
|
||||
Vector<String> arguments;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_option(g_report_to_debug, "Write reports to the debug log", "report-to-debug", 0);
|
||||
parser.add_positional_argument(command, "Command to emulate", "command");
|
||||
parser.add_positional_argument(arguments, "Command to emulate", "command");
|
||||
parser.parse(argc, argv);
|
||||
|
||||
auto executable_path = Core::find_executable_in_path(command[0]);
|
||||
auto executable_path = Core::find_executable_in_path(arguments[0]);
|
||||
if (executable_path.is_empty()) {
|
||||
executable_path = Core::File::real_path_for(command[0]);
|
||||
executable_path = Core::File::real_path_for(arguments[0]);
|
||||
if (executable_path.is_empty()) {
|
||||
reportln("Cannot find executable for '{}'.", executable_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Vector<String> arguments;
|
||||
for (auto arg : command) {
|
||||
arguments.append(arg);
|
||||
}
|
||||
|
||||
Vector<String> environment;
|
||||
for (int i = 0; env[i]; ++i) {
|
||||
environment.append(env[i]);
|
||||
|
|
Loading…
Reference in a new issue