tolga9009 / sidewinderd

Linux support for Microsoft SideWinder X4 / X6 and Logitech G103 / G105 / G710+.

Home Page:http://cevel.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sidewinderd misses recommended --help command line switch

luziferius opened this issue · comments

Hi,

As the title reads, sidewinderd misses the --help command line switch, which is recommended by GNU:
https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html

Greetings,
Thomas

I have added that switch in this branch: feature/cmd_line_help_switch. But I’m not quite sure about the implementation as that might be a bit overkill.
It does not simply dump some const char* to std::cout, instead the code lets you define options in a almost declarative manner and then formats the output when requested.
Declare options like this and get neatly aligned output without ever breaking the formatting (as long as there are no multi-byte unicode characters in short/long options…).
The downside is that this code requires C++14 syntax to declare the options array and some of the constexpr magic used.

Hi there!

Thanks for your efforts! Your implementation definitely makes sense for a more feature-rich CLI program, like e.g. ffmpeg. However, bumping up C++11 requirements to C++14 for showing the help text is indeed a bit overkill.

At least in the current state, I think it makes more sense to go for a simple std::cout solution here. I don't have huge plans for CLI, so I don't think it will get hugely more complex in near future.

I will see, if I can reuse some parts. Thank you!

Cheers,
Tolga

I've pushed out d6d2513, which addresses this issue. Feel free to make further adjustments, if something stays unclear or is phrased incorrectly. I'm closing this issue now.

Thanks for reporting!

Cheers,
Tolga

I could have done the same thing in C++11, but it won’t look as neat (at least for me my C++14 implementation looks neat^^), because of a different, less readable initializer syntax.
As I stated initially, my solution »might be a bit overkill«. So no problem for not using it.

I annotated some bits in your linked commit diff. I feel like doing a pull request for that small change is a bit much.

Greetings,
Thomas

Problem with C++14 is, that it's not as wide-spread and well-supported as C++11. For Arch Linux users, this might be not an issue, but there are several Linux distros out there, which have a much longer lifecycle and often ship old software versions. I don't want to exclude users of those distros for features, which can be implemented using C++11.

Cheers,
Tolga