js: Port to LibMain :^)

This wasn't particularly difficult, and there's not much use for the
nicer interface yet either. While unveil() is of limited use in js(1)
as it should be able to open arbitrary files, I feel like we should be
able to add a pledge() call.
This commit is contained in:
Linus Groh 2021-11-22 19:25:30 +00:00 committed by Andreas Kling
parent ba0f89a4d1
commit cfecfbb214
3 changed files with 5 additions and 4 deletions

View file

@ -455,7 +455,7 @@ if (BUILD_LAGOM)
add_executable(js_lagom ../../Userland/Utilities/js.cpp)
set_target_properties(js_lagom PROPERTIES OUTPUT_NAME js)
target_link_libraries(js_lagom LagomJS LagomLine Threads::Threads)
target_link_libraries(js_lagom LagomJS LagomLine LagomMain Threads::Threads)
add_executable(markdown-check_lagom ../../Userland/Utilities/markdown-check.cpp)
set_target_properties(markdown-check_lagom PROPERTIES OUTPUT_NAME markdown-check)

View file

@ -70,7 +70,7 @@ target_link_libraries(grep LibRegex)
target_link_libraries(gunzip LibCompress)
target_link_libraries(gzip LibCompress)
target_link_libraries(id LibMain)
target_link_libraries(js LibJS LibLine)
target_link_libraries(js LibJS LibLine LibMain)
target_link_libraries(keymap LibKeyboard)
target_link_libraries(lspci LibPCIDB)
target_link_libraries(lsusb LibUSBDB)

View file

@ -60,6 +60,7 @@
#include <LibJS/Runtime/TypedArray.h>
#include <LibJS/Runtime/Value.h>
#include <LibLine/Editor.h>
#include <LibMain/Main.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
@ -1102,7 +1103,7 @@ public:
}
};
int main(int argc, char** argv)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
bool gc_on_every_allocation = false;
bool disable_syntax_highlight = false;
@ -1123,7 +1124,7 @@ int main(int argc, char** argv)
#endif
args_parser.add_option(disable_syntax_highlight, "Disable live syntax highlighting", "no-syntax-highlight", 's');
args_parser.add_positional_argument(script_paths, "Path to script files", "scripts", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
args_parser.parse(arguments.argc, arguments.argv);
bool syntax_highlight = !disable_syntax_highlight;