Tuesday, 17 September 2013

BizArk::Command-line parsing library

Some time ago I needed a simple command line parsing library. After some research I came to BizArk ToolKit by Brian Brewder. Since then I became addicted to this library, contributed a few features of my own, fixed a few bugs. Now I am proud to tell that its recent release version Bizark.Core 2.0.3 is available on nuget. Please don't get confused with the BizArk toolkit of older versions. Here is a sample usage:
 
    public enum ConsoleMode
    {
        Copy,
        Move
    }

    public class SimpleCommandLineArgs : CmdLineObject
    {
        [CmdLineArg]
        public ConsoleMode Mode { get; set; }

        [CmdLineArg]
        public string Path { get; set; }
    }

    public static class Program
    {
        private static void Main(string[] args)
        {
            ConsoleApplication.RunProgram<SimpleCommandLineArgs>(Start);
        }

        private static void Start(SimpleCommandLineArgs args)
        {
            // Your code goes here
        }
    }
It will parse the following command-line arguments and create an instance of SimpleCommandLineArgs:
 
C:> YouConsole.exe /Mode Move /Path C:\ 
Now available on nuget.org

PM> Install-Package BizArk.Core

For more info visit project site on CodePlex: BizArk
Post a Comment