mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
rm: Port to LibMain
This commit is contained in:
parent
5f602e39e9
commit
0fea2203dc
2 changed files with 7 additions and 7 deletions
|
@ -149,6 +149,7 @@ target_link_libraries(pro LibMain LibProtocol)
|
||||||
target_link_libraries(ps LibMain)
|
target_link_libraries(ps LibMain)
|
||||||
target_link_libraries(pwd LibMain)
|
target_link_libraries(pwd LibMain)
|
||||||
target_link_libraries(rev LibMain)
|
target_link_libraries(rev LibMain)
|
||||||
|
target_link_libraries(rm LibMain)
|
||||||
target_link_libraries(run-tests LibRegex)
|
target_link_libraries(run-tests LibRegex)
|
||||||
target_link_libraries(shot LibGUI)
|
target_link_libraries(shot LibGUI)
|
||||||
target_link_libraries(shuf LibMain)
|
target_link_libraries(shuf LibMain)
|
||||||
|
|
|
@ -8,15 +8,14 @@
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath cpath", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath cpath"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool recursive = false;
|
bool recursive = false;
|
||||||
bool force = false;
|
bool force = false;
|
||||||
|
@ -30,10 +29,10 @@ int main(int argc, char** argv)
|
||||||
args_parser.add_option(verbose, "Verbose", "verbose", 'v');
|
args_parser.add_option(verbose, "Verbose", "verbose", 'v');
|
||||||
args_parser.add_option(no_preserve_root, "Do not consider '/' specially", "no-preserve-root", 0);
|
args_parser.add_option(no_preserve_root, "Do not consider '/' specially", "no-preserve-root", 0);
|
||||||
args_parser.add_positional_argument(paths, "Path(s) to remove", "path", Core::ArgsParser::Required::No);
|
args_parser.add_positional_argument(paths, "Path(s) to remove", "path", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
if (!force && paths.is_empty()) {
|
if (!force && paths.is_empty()) {
|
||||||
args_parser.print_usage(stderr, argv[0]);
|
args_parser.print_usage(stderr, arguments.argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue