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.

The NuGet package is on

Tell me more

Going commando is as simple as it is liberating – consider this (imaginary) command line utility – first, add a nice banner and delegate execution to GoCommando:

Then you add commands to the assembly – one command could be this:

allowing you to invoke the program like this:

What was that?

Just this:

  • The [Command("command-name")] attribute applied to a class declares that class a command
  • The [Parameter(...)] attribute applied to a command class’ properties defines ALL parameters that the command accepts
  • The [Parameter(...)] attribute has several options that can e.g. supply a default value, bind to the application configuration file, etc.
  • A [Description("bla bla")] attribute can be added to both a command class and a parameter property in order to provide a help-text for that
  • An [Example("true")] attribute can be added any number of times to a parameter property to add possible example values to the help-text

And then, if your GoCommando-based CLI program is not invoked properly, you get nice help texts – e.g.

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.