Assertfail

All Posts assertfail

View the Blog on GitHub wallymathieu

Isop infers parameters

21 Sep 2013

Command line tools should do what people expect. It’s a bit chaotic to navigate how to parse command line parameters since there are many conventions.

<ul>

  • A single - to indicate a short parameter, that is: -a
  • Two -- to indicate a long parameter, that is: --alpha
  • A single / to indicate a parameter, that is: /alpha
  • A single - to indicate a parameter, that is: -alpha
  • A parameter followed by a space and then a value for that parameter: /alpha value
  • A parameter followed by a = and then a value for that parameter: --alpha=value
  • The position of the parameter (the ordinal position) to indicate simply a value
  • </ul>

    I've added code to try to infer value for a parameter using it's ordinal position when there are no ordinary parameters present before the inferred parameter value.

    This simply means that it should be possible to write:
    my.exe --param1=something --param2=someother
    and also:


    <blockquote class="tr_bq"> my.exe something someother </blockquote> Please register any bugs on github. The new version is available on nuget.
    <div>
    </div>
    <div> </div>

    Tags

  • cli
  • option
  • Comments or errors? Fork post and do a pull request on github