apps: Add rm
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-04-12 18:11:43 +02:00
parent 417e505750
commit 3618a41bcd
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 18 additions and 0 deletions

View File

@ -22,3 +22,4 @@ luna_app(ls.cpp ls OFF)
luna_app(chown.cpp chown OFF)
luna_app(chmod.cpp chmod OFF)
luna_app(mkdir.cpp mkdir OFF)
luna_app(rm.cpp rm OFF)

17
apps/rm.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <os/ArgumentParser.h>
#include <stdio.h>
int main(int argc, char** argv)
{
StringView path;
os::ArgumentParser parser;
parser.add_positional_argument(path, "path"_sv, true);
parser.parse(argc, argv);
if (remove(path.chars()) < 0)
{
perror("rm");
return 1;
}
}