README and LICENSE

This commit is contained in:
Tilo-K
2025-06-20 16:03:25 +02:00
parent 6d36b8ec16
commit e80d501891
2 changed files with 73 additions and 1 deletions

21
LICENSE.md Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Tilo Klarenbeek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,7 +1,58 @@
# SeaFlags: A Simple C Library for Command Line Argument Parsing
<div style="text-align: center; items-align: center; justify-content: center; display: flex; width: 100%;">
<img src="https://github.com/tilo-k/sea-flags/blob/master/logo.png" alt="SeaFlags Logo" width="300" height="300">
</div>
### SeaFlags is a simple library for parsing command line arguments.
SeaFlags is a straightforward C library designed for parsing command-line arguments. It offers a simple and efficient way for developers to manage flags and options in their C applications, making command-line interfaces easier to build and maintain.
## Features
* **Simplified API:** Easy-to-use functions for defining and parsing flags.
* **Flexible Flag Support:** Handles both short (`-s`) and long (`--long`) argument formats.
<!-- * **Automatic Help:** Generates `--help` messages. -->
* **Error Reporting:** Provides clear feedback on parsing issues.
## Getting Started
Here's a basic example demonstrating how to parse a string argument:
```c
#include <seaflags.h>
#include <stdio.h> // Required for printf
int main(int argc, char** argv) {
struct SeaFlagSet flags;
// Initialize with program info: name, version, author, description
seaflags_init(&flags, "Sea Flag Example", "0.0.0", "Tilo" , "Example for the seaflags library");
char* name = NULL; // Variable to store the parsed --name argument
// Add a flag: long_name, short_name, is_required, pointer_to_store_value
seaflags_add_flag(&flags, "--name", "-n", true, &name);
// Parse the command line arguments
int result = seaflags_parse(&flags, argc, argv);
if (result != 0) {
fprintf(stderr, "Error parsing flags.\n"); // SeaFlags typically prints error details too
return 1;
}
// Access the parsed argument
printf("Hello, %s!\n", name);
seaflags_free(&flags); // Free the memory allocated by SeaFlags
return 0;
}
```
## Contributing
Contributions are welcome. Please refer to the [Code of Conduct](https://tilok.dev/coc).
## License
This project is licensed under the MIT License. See the `LICENSE` file for details.