GoCommando is a small command line utility helper that does the boring work when creating command line utilities in .NET.

Source code and stuff is on Github.

Tell me more

Going commando is as simple as it is liberating – consider this (imaginary) command line utility:

allowing a potential usage scenario like this:

What was that?

Positional argument: PositionalArgumentAttribute is used to bind the first couple of arguments (if any). As soon as the command line has a named argument, further arguments are assumed to be named.

Positional arguments are bound in the order they appear in the class declaration.

Named argument: NamedArgumentAttribute is used to bind command lines on the form /name:value to a property. Named arguments can have a full name and a shorthand (full name is for n00bs, shorthand is definitely more 1337).

Banner: BannerAttribute is an (optional) attribute that can be used to specify the initial output from the program.

bool: Properties of type bool are assumed to be named value-less flag-type parameters – i.e. either you specify /name on the command line (yielding a value of true), or you don’t (guess what the value is then?)…

…and there’s more!

Description: DescriptionAttribute is used to specify a textual description that will be output when automagically generating a help text for the utility.

Examples: ExampleAttribute can be used to specify one or more examples on acceptable values for that particular parameter.

E.g. like so:

6 thoughts on “GoCommando

  • 27. September 2011 at 07:38

    I’m looking into implementing a command line utility. I think GoCommando looks just like the framework I need. How about doing a NuGet package?

  • 27. September 2011 at 08:38

    Great idea!

    I’ll look into it some time in the future when I have the time and HAHA JUST KIDDING, check this out: GoCommando in the NuGet Gallery.

    Install-Package GoCommando and you have been liberated!

  • 27. September 2011 at 10:58

    Great! Thank you very much, Mookid.

    By the way, I solved one of the TODO’s in todo.txt. It is now possible to provide a factory methods to the Run-method, which makes it possible to provide your own instance of ICommando. There’s a pull request at GitHub waiting for you.

  • 27. September 2011 at 12:38

    Pull request has been slightly simplified and merged – thanks :)

  • 27. September 2011 at 12:40

    PS: Update-Package GoCommando

Comments are closed.