-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I have 2 ykush boards connected to my PC and refer to them using -s option.
ykushcmd will ignore -s silently. when -s YKxxxx isn't the first arguement.
I know the docs and cmdline help say to use -s first.
Still, I think one could greatly improve this UX (there was no state change of YK boards inbetween):
bash-5.1$ ./ykushcmd -s YK11111 -g 3
Downstream port 3 is ON
bash-5.1$ ./ykushcmd -s YK66666 -g 3
Downstream port 3 is OFF
bash-5.1$ ./ykushcmd -g 3 -s YK11111
Downstream port 3 is ON
bash-5.1$ ./ykushcmd -g 3 -s YK66666
Downstream port 3 is ONYK66666, port 3 if OFF all the time, if you measure it.
Reading the code, it seems ykushcmd indeed ignores the option (line 35 case vs. line 57 case).
https://github.com/Yepkit/ykush/blob/master/src/ykush/ykush.cpp
Maybe it's easiest to just throw out the hand-written commandline parser and use some popular library?
E.g. Stackoverflow has some examples. Though, boost is probably overkill here.
https://stackoverflow.com/questions/865668/parsing-command-line-arguments-in-c
Happy to hear any input on this.
PC: Ubuntu 22.04
YKUSHCMD Version 1.3.1