mirror of
https://github.com/Tilo-K/sea-flags.git
synced 2026-01-09 15:31:02 +00:00
feat: add basic parsing and readme
This commit is contained in:
29
includes/seaflags.h
Normal file
29
includes/seaflags.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
struct SeaFlag {
|
||||
char* name;
|
||||
char* short_name;
|
||||
bool is_required;
|
||||
|
||||
char** value;
|
||||
struct SeaFlag* next;
|
||||
};
|
||||
|
||||
struct SeaFlagSet {
|
||||
struct SeaFlag* firstFlag;
|
||||
|
||||
char* programName;
|
||||
char* programVersion;
|
||||
char* programAuthor;
|
||||
char* programDescription;
|
||||
};
|
||||
|
||||
#define SEAFLAGS_UNKNOWN_FLAG 0b00000001
|
||||
#define SEAFLAGS_UNKNOWN_POSITIONAL_ARG 0b00000010
|
||||
#define SEAFLAGS_MISSING_REQUIRED_FLAG 0b00000100
|
||||
|
||||
|
||||
void seaflags_init(struct SeaFlagSet* flags, char* programName, char* programVersion, char* programAuthor, char* programDescription);
|
||||
void seaflags_add_flag(struct SeaFlagSet* flags, char* name, char* short_name, bool is_required, char** value);
|
||||
int seaflags_parse(struct SeaFlagSet* flags, int argc, char** argv);
|
||||
void seaflags_free(struct SeaFlagSet* flags);
|
||||
Reference in New Issue
Block a user