Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
Final proofread and code cleanup. 0.0.4 should be ready for rollout
Browse files Browse the repository at this point in the history
  • Loading branch information
Captainjamason committed Feb 11, 2024
1 parent 901f351 commit f5a3c3a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: C/C++ CI

on:
push:
branches: [ "main" ]
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*.out
*.app

# Custom
build
.cache/
*.core
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) {
opencxx_cli::CLI cli;

std::vector<CLI::entryData> 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;
Expand All @@ -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:
Expand All @@ -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
6 changes: 6 additions & 0 deletions src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -90,6 +95,7 @@ vector<string> 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<CLI::entryData> entries) {
//cout << "[opencxx-cli] Help is under construction...\n";
CLI::programInfo pgInfo;
Expand Down
4 changes: 3 additions & 1 deletion src/unitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,21 @@ 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);
entries[0].func();
entries[1].func();
}

// Test parsing of arguments.
if(test == "-testParse") {
cli.addEntry("--test", "-t", testFunc, &entries);
cli.addEntry("--t2", "-t2", testFunc, &entries);
Expand Down

0 comments on commit f5a3c3a

Please sign in to comment.