C/C++ command line flags library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

2 years ago
# flagok (флажок) - C/C++ command line flags library
## Installation
2 years ago
1. `git clone https://unbewohnte.su:3000/Unbewohnte/flagok.git`
2. Either `make static`|`make` to make a static|shared library (if you have make and other *NIX utilities) or simply put header file into your project and compile it your own way
2 years ago
## Usage
2 years ago
Each flag has its `name`, `value`, `description` and
- `flag_bool` (bool)
- `flag_int` (long long)
- `flag_uint` (unsigned long long)
- `flag_double` (long double)
- `flag_string` (char*)
are available to be called
Example:
```
long long int_value = 1;
char* string_value = "hello";
bool bool_value = false;
flag_int(&int_value, "-intval", "set int");
flag_str(&string_value, "-stringval", "set string");
flag_bool(&bool_value, "-boolval", "set true or false");
flag_parse(argc, argv);
```
`-help` flag is set automatically and when presented, prints all registered flags' information to stdout
Right now the parsing process is not strict and does not output any errors. When for example the argument to integer flag was not provided - the parse function will simply move on onto the next argument and leave the current value untouched.
2 years ago
## License
LGPLv3