1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

Userland+Terminal: Port to new CArgsParser API

While at it, also add some niceties and fix some things.
This commit is contained in:
Sergey Bugaev 2020-01-27 20:25:36 +03:00 committed by Andreas Kling
parent 9276582535
commit f983dfe319
22 changed files with 392 additions and 653 deletions

View file

@ -193,11 +193,11 @@ int main(int argc, char** argv)
return 1;
}
CArgsParser args_parser("Terminal");
const char* command_to_execute = "/bin/Shell";
args_parser.add_arg("e", "execute", "Execute this command inside the terminal.");
CArgsParserResult args = args_parser.parse(argc, argv);
CArgsParser args_parser;
args_parser.add_option(command_to_execute, "Execute this command inside the terminal", nullptr, 'e', "command");
args_parser.parse(argc, argv);
if (chdir(get_current_user_home_path().characters()) < 0)
perror("chdir");
@ -208,7 +208,7 @@ int main(int argc, char** argv)
return 1;
}
run_command(ptm_fd, args.get("e"));
run_command(ptm_fd, command_to_execute);
auto window = GWindow::construct();
window->set_title("Terminal");
@ -269,7 +269,6 @@ int main(int argc, char** argv)
edit_menu->add_action(terminal->paste_action());
menubar->add_menu(move(edit_menu));
GActionGroup font_action_group;
font_action_group.set_exclusive(true);
auto font_menu = GMenu::construct("Font");