This project is read-only.

What is Gemini.CommandLine?

What does it do?

Gemini.CommandLine allows you to write console apps faster by taking away the burden of handling the arguments for you. It does so by using reflection to find a type and method that fits the arguments provided and binds to that.

Getting started

To get started, start a new Console project in Visual Studio, and add the Gemini.CommandLine library by way of NuGet, for example by using the Package Manager Console:

Install-Package Gemini.CommandLine

The package only adds the library so far. The next step is to hand over control in the app's Main method. Replace your program with the following, as a demonstration:

    class Program
        static void Main(string[] args)

        public static void HelloWorld()
            Console.WriteLine("Hello, world!");

The static method Command.FromArguments() returns a parsed Command object, on which you call the Run() method passing any types that may be considered. (In the future, I may consider all public types if you don't pass any). I pass Program as the type here to avoid needing another class, but that's irrelevant.

Then you run the app from the command line, by adding the name of the method on Program that you want to call. In this example, I added a static method HelloWorld that I can now call like this:

ConsoleApplication1 HelloWorld

What's next?

More to come...

Last edited Nov 17, 2012 at 10:49 AM by DaveVdE, version 2


No comments yet.