Skip to content

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

@remkop

Description

@remkop

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>...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions