mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:28:11 +00:00
Shell: Read script arguments as Strings instead of char*s
This saves work in places that previously had to create a `Vector<String>` anyway, or repeatedly cast the char* to a String. Plus, Strings are nicer than char*. :^)
This commit is contained in:
parent
1ac6c4df72
commit
84b67754c0
2 changed files with 21 additions and 34 deletions
|
@ -159,7 +159,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
char const* command_to_run = nullptr;
|
||||
char const* file_to_read_from = nullptr;
|
||||
Vector<char const*> script_args;
|
||||
Vector<String> script_args;
|
||||
bool skip_rc_files = false;
|
||||
char const* format = nullptr;
|
||||
bool should_format_live = false;
|
||||
|
@ -228,12 +228,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
shell->cache_path();
|
||||
}
|
||||
|
||||
{
|
||||
Vector<String> args;
|
||||
for (auto* arg : script_args)
|
||||
args.empend(arg);
|
||||
shell->set_local_variable("ARGV", adopt_ref(*new Shell::AST::ListValue(move(args))));
|
||||
}
|
||||
shell->set_local_variable("ARGV", adopt_ref(*new Shell::AST::ListValue(move(script_args))));
|
||||
|
||||
if (command_to_run) {
|
||||
dbgln("sh -c '{}'\n", command_to_run);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue