optionparser icon indicating copy to clipboard operation
optionparser copied to clipboard

Short flags without spaces

Open rnewton opened this issue 11 years ago • 0 comments

This library cannot parse short options passed without spaces between the flag and the value. For an example, I use cp:

$ touch testfile
$ mkdir testdir
$ cp testfile -ttestdir
$ ls testdir/
testfile

Where '-t' is the short option (to directory).

The current version of the library, given the same rule ('t'), will fail when it encounters the first letter of the parameter that doesn't have a corresponding rule. In this case, possibly 'e'. Additionally, the regex matching for a more complex case in the same vein will fail when any character other than a-z and '-' is encountered, such as a hostname or url. (-hexample.domain.com).

This is complicated by the fact that this is easy to apply to short flags that require a parameter. Optional parameters, however, would require additional checking to see if the current token is a listing of short flags or a short flag with parameter.

rnewton avatar Mar 20 '14 18:03 rnewton