https://github.com/usbokirishima/wimey
Wimey is a lightweight C library for building command-line tools with ease. It supports both command and argument parsing, including value handling, automatic help generation, and type-safe conversions. Designed for flexibility and minimal dependencies, Wimey helps you structure your CLI programs cleanly and efficiently.
https://github.com/usbokirishima/wimey
args args-parser c command-line cprogramming library parser posix unix
Last synced: 3 months ago
JSON representation
Wimey is a lightweight C library for building command-line tools with ease. It supports both command and argument parsing, including value handling, automatic help generation, and type-safe conversions. Designed for flexibility and minimal dependencies, Wimey helps you structure your CLI programs cleanly and efficiently.
- Host: GitHub
- URL: https://github.com/usbokirishima/wimey
- Owner: UsboKirishima
- License: gpl-3.0
- Created: 2025-04-27T13:19:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-06T17:12:33.000Z (about 1 year ago)
- Last Synced: 2025-05-15T02:14:06.614Z (about 1 year ago)
- Topics: args, args-parser, c, command-line, cprogramming, library, parser, posix, unix
- Language: C
- Homepage:
- Size: 156 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WIMEY
**Wimey** is a simple-to-use C library to parse commands and arguments, written in **less <600 Lines of Code**. It supports both command and argument parsing, including value handling, automatic help generation, and type-safe conversions. Designed for flexibility and minimal dependencies, Wimey helps you structure your CLI programs cleanly and efficiently.
## Features
- ๐งญ Command and subcommand support
- ๐งพ Positional and optional arguments
- ๐ง Type-safe argument parsing (int, bool, string, float)
- ๐ Built-in help message generation
- ๐งฑ No external dependencies
- ๐ ๏ธ Simple, clean API for building CLI tools
## How to use
```c
#include
#include "wimey.h"
int main(int argc, char **argv) {
// Init Wimey
if (wimey_init() != WIMEY_OK) {
ERR("Init failed");
return 1;
}
// Config
struct wimey_config_t cfg = {
.name = "Example",
.description = "Minimal Wimey example",
.version = "0.1",
.log_level = LOG_ALL
};
wimey_set_config(&cfg);
// Add inline command
wimey_add_command((struct wimey_command_t){
.key = "hello",
.has_value = true,
.is_value_required = true,
.value_name = "name",
.desc = "Say hello",
.callback = [](const char *val) {
INFO("Hello, %s!", val);
}
});
// Parse args
wimey_parse(argc, argv);
// Clean up
wimey_free_all();
return 0;
}
```
Please read the [full example here](example.c).
### In your project
* Clone repo:
```bash
git clone https://github.com/UsboKirishima/wimey && cd wimey
```
* Move file to your project:
```bash
mv wimey.c ~/coding/myproj
mv wimey.h ~/coding/myproj
```
* Inlude header file``
```c
/* my_file.c */
#include "wimey.h"
// or with -Iinclude
#include
```
## Contributions
Please open a [pull request](https://github.com/UsboKirishima/wimey/pulls) or [issue](https://github.com/UsboKirishima/wimey/issues), thanks!
## License
Library under [Apache 2.0 License](LICENSE)
Copyright (C) 2025 Davide Usberti