apps: Add arch
All checks were successful
Build and test / build (push) Successful in 2m16s

This commit is contained in:
apio 2024-07-21 13:07:51 +02:00
parent d10cb10404
commit 829f455129
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 23 additions and 0 deletions

View File

@ -53,3 +53,4 @@ luna_app(startui.cpp startui)
luna_app(launch.cpp launch)
luna_app(run.cpp run)
luna_app(sha256sum.cpp sha256sum)
luna_app(arch.cpp arch)

22
apps/arch.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <os/ArgumentParser.h>
#include <os/File.h>
#include <sys/utsname.h>
Result<int> luna_main(int argc, char** argv)
{
os::ArgumentParser parser;
parser.add_description("Print the current machine's architecture name."_sv);
parser.add_system_program_info("arch"_sv);
parser.parse(argc, argv);
struct utsname info;
if (uname(&info) < 0)
{
perror("uname");
return 1;
}
os::println("%s", info.machine);
return 0;
}