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;
|
||
|
};
|