-
Notifications
You must be signed in to change notification settings - Fork 5
Home
In the .NET space there are a number of good libraries to handle run-of-the-mill command line argument parsing. My current favorite is a nuget package called simply CommandLineParser. So why write a new one?
In short, current .NET command-line libraries focus only on parsing the args. You are left reponsible for interpreting the args to call the right methods with the correct arguments. What if CLI's could be as easy to structure and execute as ASP .NET MVC applications?
Install-Package Odin-Commands
Then review Getting Started.
I've done some work with Ruby over the last couple of years and I was really impressed with the feature set offered by a ruby project called thor
In addition to a declarative approach to binding options to actions and arguments, thor supports the concept of subcommands.
We've seen subcommands used to great effect in command-line programs such as git
and nuget
, but current command line parser packages
offer little help with this feature.
In ASP .NET MVC, urls are routed to the appropriate controller and action by convention. http://mysite.domain/Home/Index
is understood to route to a controller called "Home" and invoke a method called "Index."
In addition, little manual wiring is required because ASP .NET MVC can discover and instantiate the controller easily at runtime.
I wondered if it would be possible to use a combination of reflection and convention to create a command-line application in C#.
All of the major functional components of Odin are overridable.
Odin-Commands was designed with Testability and Validation in mind.