diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index ddc5a01..8e5bac5 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -2,7 +2,7 @@ name: C/C++ CI on: push: - branches: [ "main" ] + branches: [ "main", "dev" ] pull_request: branches: [ "main" ] diff --git a/.gitignore b/.gitignore index f85da30..58938e7 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ *.out *.app +# Custom build .cache/ *.core \ No newline at end of file diff --git a/README.md b/README.md index 7ac510a..2ec104c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { opencxx_cli::CLI cli; std::vector entries; - cli.addEntry("--test", "-t", testFunc, &entries); + cli.addEntry("--test", "-t", testFunc, &entries, false, "This will show on help()"); cli.parse(entries, cli.vectorize(argc, argv)); return 0; @@ -28,13 +28,20 @@ int main(int argc, char *argv[]) { More information can be found in the wiki. But the general idea is to create a vector to store entries, add entries, then run `cli.parse()` to let it handle the rest. -## Planned Features: +## Features: - [x] Basic Color Manipulation. -- [ ] Automated argument handling. - - [ ] Populate `--help` with new argument checks. +- [X] Automated argument handling. + - [X] Populate `--help` with new argument checks. - [x] Iterate over vector of arguments - [X] Call respective functions that were declared earlier in code. + - [X] `returnArg()`, Used for getting the next argument for custom functions. - [ ] Flavortext and colorizing of default commands. + - [ ] Options for default menu colorizations through a basic function and structs. +- [ ] `libCURL` like configuration on the fly. +- [ ] `--version` default menu available for fetching too. + +__More coming soon__ + ## Compiling/Installing ### Requirements: @@ -56,4 +63,6 @@ Use the provided `./install.sh` file, While it's currently a quick and dirty scr Made with love. Started by JPD <3 +__Questions? Comments? Requests? Want to chat? Join our Discord:__ https://discord.gg/JCHa4h4Y55 + hurbIndustries 2024 diff --git a/src/cli.cpp b/src/cli.cpp index 54356fd..aa935ed 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -11,9 +11,11 @@ #include "../include/cli.h" #include "../include/colors.h" +// Namespace declarations here, May rid of in the future. using namespace opencxx_cli; using namespace std; +// Global argument return string. I wish this was handled a bit better but for now its good. string argReturn; // Initialize the main 3 debug/error message commands, @@ -43,11 +45,14 @@ int CLI::info(string s) { return 0; } +// Small helper function to set the argReturn varaible. int addArg(string arg) { argReturn = arg; return 1; } +// returnArg() *must* be called from a user function if `arg = true`, This will be beneficial for +// any sort of functions that require parameters. string CLI::returnArg() { return argReturn; } @@ -90,6 +95,7 @@ vector CLI::vectorize(int argc, char *argv[]) { return args; } +// help() is bound to `--help` by default. May be customizable in the future. int CLI::help(vector entries) { //cout << "[opencxx-cli] Help is under construction...\n"; CLI::programInfo pgInfo; diff --git a/src/unitTests.cpp b/src/unitTests.cpp index 3bbc251..0f65641 100644 --- a/src/unitTests.cpp +++ b/src/unitTests.cpp @@ -44,12 +44,13 @@ int main(int argc, char* argv[]) { } } + // Test adding one entry. if(test == "-addEntryOnce") { cli.addEntry("--test", "-t", testFunc, &entries); entries[0].func(); } - //test add entry + // Test adding two entry. if(test == "-addEntryTwice") { cli.addEntry("--test", "-t", testFunc, &entries); cli.addEntry("-test2", "-t2", testFunc, &entries); @@ -57,6 +58,7 @@ int main(int argc, char* argv[]) { entries[1].func(); } + // Test parsing of arguments. if(test == "-testParse") { cli.addEntry("--test", "-t", testFunc, &entries); cli.addEntry("--t2", "-t2", testFunc, &entries);