2 ms·
Most of these problems have incorrect solution. For instance, the actual solution to parsing portrait or landscape is to not use a string for this. It should ne
by frizlab 2y ago
Most of these problems have incorrect solution. For instance, the actual solution to parsing portrait or landscape is to not use a string for this. It should never have been a string! Other better solutions apply for the rest too.
- 9rx 2y agoThe command line is defined by strings. It had to be a string to stay within end-user requirements. You may be able to make a good case that the string input is best represented as something parseable by an existing argument parser library, but even then you are dependent on that library handling the strings correctly. Which, at best, pushes the problem onto someone else. Someone else who still has to be aware of input possibilities.
- frizlab 2y agoOh missed the context, my bad. That being said, in that case, I’m definitely not convinced by the need for toLower (:
- do_not_redeem 2y agoWhy would you accept ArBiTrArY-cased command-line arguments in the first place? I don't think I've ever seen a cli utility that accepts the wrong case. Just compare the raw bytes. `ls --ALL` doesn't work, and neither should `my_app --PORTRAIT` (no matter which "I" you type).
- chrismcb 2y agoYou are pausing a command line parameter. It will always come in as a string.