Luna/libos/include/os/ArgumentParser.h
apio a164dcc160
All checks were successful
continuous-integration/drone/push Build is passing
libos: Add libos + very basic ArgumentParser
libluna but for stuff that interests only userspace, like an argument parser or files or stuff like that.
2023-03-29 18:27:02 +02:00

26 lines
594 B
C++

#pragma once
#include <luna/StringView.h>
#include <luna/Vector.h>
class ArgumentParser
{
public:
ArgumentParser() = default;
Result<void> add_positional_argument(StringView& out, StringView name, bool required);
Result<void> add_positional_argument(StringView& out, StringView name, bool required, StringView fallback);
void parse(int argc, char* const* argv);
private:
struct PositionalArgument
{
StringView* out;
StringView name;
bool required;
StringView fallback;
};
Vector<PositionalArgument> m_positional_args;
};