Commit Graph

10 Commits (69f15e928af2fb334ae5e7ce5043404c0823438d)

Author SHA1 Message Date
BodgeMaster 69f15e928a lib/cli: Add fields for a short description and additional usage information to the arguments parser
This is in preparation for building the help text generator.
2022-08-02 02:03:50 +02:00
BodgeMaster c9d6cf0b5e lib/cli: minor consistency changes 2022-07-21 09:39:45 +02:00
BodgeMaster db3b133f88 lib/cli: fix trailing incomplete unpositional arguments
The parser used to rely on the next iteration of the loop to detect
if an unpositional argument was missing its value, this has now been
fixed by adding an additional check on unpositional arguments waiting
for a value that detects if the end of the loop has been reached
2022-07-20 18:30:25 +02:00
BodgeMaster 2cbf048f2e lib/cli: make flags return more accurate error codes
revealed by writing a test and it behaving differently from what I expected
2022-07-17 12:09:19 +02:00
BodgeMaster 4c3d2fdbbf lib/cli: ArgumentsParser constructor can accept both char** and const char** 2022-07-15 13:49:43 +02:00
BodgeMaster 82d611b984 lib/cli: various fixes
- argumentWaitingForValue was never reset after the value had been retrieved
- made it so the ArgumentsParser constructor can accept const char**
- correct usage of substr() and actually use the correct position in the first place
- fix a typo where I tried to dereference `this` with `-` instead of `->`
2022-07-15 11:21:18 +02:00
BodgeMaster f5b0b74f94 lib/cli: remove useless arguments from getters, remove useless getter getProgramName (made the string public instead) 2022-07-15 09:11:39 +02:00
BodgeMaster a1223ea4b9 Minor improvements and fixes.
test/nbt_helpers: add a headline to output
Build system: remove comma from array that I added bc I thought it was correct sytax, it wasn't
lib/cli: change argument order of PositionalArgument constructor to fit in with Flag and UnpositionalArgument
lib/cli: properly define what is private and what is public in the ArgumentsParser class
2022-07-15 08:54:09 +02:00
BodgeMaster 390087fc35 lib/cli: finish initial implementation
This should be all functionality that is needed for now.
The next step is building unit tests to check that everything works correctly.

Who am I kidding? There will most certainly be bugs in there given that this
code has been typed out without ever being run.
2022-07-14 04:57:48 +02:00
BodgeMaster 91f3dfaa5e lib/cli: Add a library for command line arguments parsing
This has the parser itself already implemented, all other functionality is still
missing. So are tests.

Yes, I’m making my own getopt. Let me.
2022-07-14 03:13:48 +02:00