ebenoist / libblinkstick

A blinkstick library in C
MIT License
11 stars 9 forks source link

Improve CLI Error Handling #22

Open DeveloperPaul123 opened 6 years ago

DeveloperPaul123 commented 6 years ago

Currently the CLI cannot tolerate missing input arguments or input arguments in arbitrary order.

For example: --color 255 0 0 --channel 0 --debug versus --debug --channel 0 --color 255 0 0

DeveloperPaul123 commented 6 years ago

@ebenoist Just curious but why was this closed?

ebenoist commented 6 years ago

Totally a mistake, sorry about that!

DeveloperPaul123 commented 6 years ago

Ok just checking 😄 No worries

DeveloperPaul123 commented 6 years ago

@ebenoist Are you open to making the command line tool cpp code? That way we can leverage the STL to improve command handling.

If we can use C++, we can use a library to do the command line parsing. The problem of command line parsing has been solved already so no need to do it manually. I'm thinking this would be a good fit.

DeveloperPaul123 commented 6 years ago

@ebenoist Thoughts on the above ^ comment?

ebenoist commented 6 years ago

@DeveloperPaul123 Any reason not to just use use getopts? I've use it before and its included on most systems.

DeveloperPaul123 commented 6 years ago

@ebenoist getopts is not available on windows. That would be the main reason for me. I have the ability to test code on Linux and Windows but not MacOS currently.

DeveloperPaul123 commented 5 years ago

@ebenoist Any further thoughts on this?

ebenoist commented 5 years ago

Sorry, this fell to the bottom of my inbox. I'd like to avoid adding any C++ deps to this library. I'm pretty sure getopts is portable, could we vendor it in for windows users?

https://gist.github.com/superwills/5815344

DeveloperPaul123 commented 5 years ago

Ok that's fine, but getopt is not available on windows by default. You'd have to find a way to install and/or build unix/linux tools on windows to get access to getopt or include the file you linked to in this project directly and build it with the CLI.

ebenoist commented 5 years ago

I'm totally okay with vendoring in getopts so that this library is portable. Would that work?

DeveloperPaul123 commented 5 years ago

We could give it a try, maybe in a new branch. I can test on windows and let you know if it works.

DeveloperPaul123 commented 5 years ago

Are you planning on adding in getopts?