lexicalscope/jewelcli

The option "/?" cannot be registered

Zero3 opened this issue · 2 comments

Trying to register the help command line option "/?" (which is common on the Windows platform) doesn't work. It silently gets translated to "-/". Is this a bug?

This certainly sounds like a bug, I will take a look. Although feel free to
submit a patch if you can find the problem.

On Thu, Mar 26, 2015 at 7:30 PM, Zero3 notifications@github.com wrote:

Trying to register the help command line option "/?" (which is common on
the Windows platform) doesn't work. It silently gets translated to "-/". Is
this a bug?


Reply to this email directly or view it on GitHub
#34.

I believe I found the reason:

The '-' is apparently prefixed shortName names (which I was passing my "/?" as).
The '/' is apparently because JewelCli blindly uses the first character of the provided String.

I'm not sure if this procedure is intended, but I see a couple of issues with the current approach:

  1. Short names must start with '-'. This is perfectly sensible in a Linux environment, but not so much for Windows where the '/' character is more common.

  2. JewelCli should not blindly throw away anything but the first character of a shortName. I would expect an exception.

  3. The signature for the shortName property is an array of String. This doesn't make much sense if everything but the first character is thrown away anyway. Should it have been an array of Character?

  4. On a related note, I attempted to use the longName property instead. It has a similar issue about prefixing "--", leading to the awkward "--/?" option. I assume this makes options like "/someoption" impossible with JewelCli?