apio
a164dcc160
All checks were successful
continuous-integration/drone/push Build is passing
libluna but for stuff that interests only userspace, like an argument parser or files or stuff like that.
26 lines
594 B
C++
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;
|
|
};
|