feat: add basic parsing and readme

This commit is contained in:
Tilo-K
2025-06-20 15:34:49 +02:00
parent 55e42817be
commit 126fc422c5
4 changed files with 303 additions and 2 deletions

29
includes/seaflags.h Normal file
View 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);