Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Various fixes for usages derived from the @arg annotation. #188

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Aug 17, 2016

  1. Configuration menu
    Copy the full SHA
    65153dd View commit details
    Browse the repository at this point in the history
  2. Various fixes for usages derived from the @arg annotation.

    Enforce if both 'flag' and 'name' are given in the `@arg` annotation, the
    length of 'flag' is less than or equal to the length of 'name'.  It is ok
    if the length of 'name' derived from the constructor-parameter/field is
    less than the length of 'flag', and in this cause we'll print 'flag'
    second. Examples:
    1. `@arg(flag="abc", name="a") val a: T` should be illegal
    2. `@arg(flag="abc") val a: T` will have usage "-a T, --abc=T"
    Previously it would not check and print the following usages for 1-2
    above:
    1. "-abc T, --a=T". Note that specifying either "-abc T" or "--a T"
    wouldn't work.
    2. "-abc T, -a=T". Note that specifying "-abc T" wouldn't work.
    
    Format a single-character flag correctly if specified in name or the
    variable/field is a single-character.
    - `@arg(name="a") val abc: T` will have usage "-a T".
    - `@arg val a: T` will have usage "-a T".
    
    Add a regression test for the 'name' field being camel case:
    - `@arg(name="aB") val a: T` will have usage "--aB=T".
    
    Fix the usage for multi-character flag arguments.  For example, if
    `@arg(flag="abc") val abcd: T` then the usage will be
    "--abc=T, --abcd=T"; it was previously "-abc T, --abcd=T".
    
    Make it ok for the 'flag' and derived 'name' are the same, but only
    print out one: `@arg(flag="a") val a: T` will be "-a T".
    
    Updated the documentation for ArgAnnotation for all the above.
    nh13 committed Aug 17, 2016
    Configuration menu
    Copy the full SHA
    9ec712d View commit details
    Browse the repository at this point in the history