Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage help should show Map types if paramLabel not specified #195

Closed
remkop opened this issue Sep 30, 2017 · 0 comments
Closed

Usage help should show Map types if paramLabel not specified #195

remkop opened this issue Sep 30, 2017 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented Sep 30, 2017

Currently a Map option needs to specify a paramLabel to indicate the parameter is a KEY=VALUE pair. If no paramLabel is specified, the generated usage help should show keyType=valueType.

Example:

        class Args {
            @Option(names = "-a") // default
            Map<String, String> a;
            @Option(names = "-b", arity = "0..*", type = {Integer.class, Integer.class})
            Map<Integer, Integer> b;
            @Option(names = "-c", paramLabel = "KEY=VALUE", arity = "1..*", type = {String.class, TimeUnit.class})
            Map<String, TimeUnit> c;
            @Option(names = "-d", arity = "2..*", type = {String.class, URL.class})
            Map<String, URL> d;
        }

Desired usage help output:

Usage: <main class> [-a=<String=String>]... [-b=[<Integer=Integer>]...]...
                    [-c=KEY=VALUE...]... [-d=<String=URL> <String=URL>...]...
  -a= <String=String>
  -b= [<Integer=Integer>]...
  -c= KEY=VALUE...
  -d= <String=URL> <String=URL>...

Currently shows:

Usage: <main class> [-a=<a>]... [-b=[<b>]...]... [-c=KEY=VALUE...]... [-d=<d>
                    <d>...]...
  -a= <a>
  -b= [<b>]...
  -c= KEY=VALUE...
  -d= <d> <d>...
@remkop remkop added this to the 2.0.0 milestone Sep 30, 2017
@remkop remkop closed this as completed in 7385fc8 Oct 1, 2017
@remkop remkop changed the title Map options should show types in usage help message if paramLabel not specified Usage help should show Map types if paramLabel not specified Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant