apps: Add gclient

This commit is contained in:
apio 2023-08-07 22:45:00 +02:00
parent 5ab83343c6
commit cf341dd82f
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 21 additions and 0 deletions

View File

@ -46,3 +46,4 @@ luna_app(socket-test.cpp socket-test)
luna_app(socket-client.cpp socket-client)
luna_app(input.cpp input)
luna_app(shmem-test.cpp shmem-test)
luna_app(gclient.cpp gclient)

20
apps/gclient.cpp Normal file
View File

@ -0,0 +1,20 @@
#include <os/ArgumentParser.h>
#include <os/LocalClient.h>
Result<int> luna_main(int argc, char** argv)
{
StringView socket_path = "/tmp/wind.sock";
os::ArgumentParser parser;
parser.add_description("A graphical user interface client."_sv);
parser.add_system_program_info("gclient"_sv);
parser.add_value_argument(socket_path, 's', "socket"_sv, "the path for the local IPC socket"_sv);
parser.parse(argc, argv);
auto client = TRY(os::LocalClient::connect(socket_path, false));
StringView message = "hello";
TRY(client->send((const u8*)message.chars(), message.length()));
return 0;
}