https://github.com/jstmaxlol/ecah-lib
ecah-lib is a header-only library to easily handle arguments in C++ (!)
https://github.com/jstmaxlol/ecah-lib
argument-handler cpp header library public
Last synced: 3 months ago
JSON representation
ecah-lib is a header-only library to easily handle arguments in C++ (!)
- Host: GitHub
- URL: https://github.com/jstmaxlol/ecah-lib
- Owner: jstmaxlol
- License: unlicense
- Created: 2024-12-04T20:35:54.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-01-12T14:35:52.000Z (4 months ago)
- Last Synced: 2025-01-12T15:34:59.456Z (4 months ago)
- Topics: argument-handler, cpp, header, library, public
- Language: C++
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# archived,
### check out [salib](https://github.com/jstmaxlol/salib), basically a simpler && better version of ecah-lib
# ecah-lib 💊
**ecah-lib** (**e***asier* **c***pp* **a***rgument* **h***andler* **lib***rary*) \
is a header-only library to easily handle arguments in **C++** *(!)*### [download ecah-lib](https://github.com/jstmaxlol/ecah-lib/blob/main/ecah-lib.h)
## how to use ⁉️
to use **ecah-lib** you need to [download](https://github.com/jstmaxlol/ecah-lib/blob/main/ecah-lib.h) the library's **.h (header)** file and `#include` it in your **C++** project \
if the header file is in the same directory as your **.cpp** file `#include "ecah-lib.h"` \
here's an example program, for more (and more practical) example programs, check out the [./examples](https://github.com/jstmaxlol/ecah-lib/tree/main/examples) directory in this repo;
```
#include "ecah-lib.h" // Including ecah-lib in our project
using namespace eca; // Optionally use the `eca` namespace (Basically if you do not want to use the `eca::` prefix on ecah-lib's methods/functions)int main(int argc, char* argv[]) // argc = count of command-line arguments, argv = array of command-line argument strings
{
string firstArgument; // Create an empty stringarg.store(firstArgument, 1, argc, argv); // Store the first argument in the string `programName` (index 1 in the argv array)
cout << "The first argument is: " << firstArgument << "\n"; // Prints the first argument
return 0; // Returns 0 (Basically quits the program)
}/*
Compiled with g++ on Arch Linux, output;
$ g++ -o test main.cpp
$ ./test Hello!
The first argument is: Hello!
*/
```
###### jstmax@62-69-74-2E-6C-79-2F-6D-78-5F-69-6E-66-6F