Skip to content

cointoss1973/EasyCommandLineParser

Repository files navigation

EasyCommandLineParser

Overview

EasyCommandLineParser is a easy-to-use command line parser.
It works with a single file, there is no license in the code, and it is free for anyone to use.

Example

using EasyCommandLineParser;

class Program
{
    class Options
    {
        [Option('s', "string", Required = false, HelpText = "String value")]
        public string Text { get; set; }
        [Option('i', "int", Required = false, HelpText = "Int value")]
        public int IntValue { get; set; }
        [Option('d', "double", Required = false, HelpText = "Double value")]
        public double DoubleValue { get; set; }
    }

    static void Main(string[] args)
    {
        var result = Parser.Parse<Options>(args);

        if (result.Tag == ParserResultType.Parsed)
        {
            System.Console.WriteLine("string value: {0}", result.Value.Text);
            System.Console.WriteLine("int value: {0}", result.Value.IntValue);
            System.Console.WriteLine("double value: {0}", result.Value.DoubleValue);
        }
    }
}
> sample.exe -s hello --int 100 -d 123.456
> string value: hello
> int value: 100
> double value: 123.456

Where is the source code?

Download directly here!
https://raw.githubusercontent.com/cointoss1973/EasyCommandLineParser/master/EasyCommandLineParser/EasyCommandLineParser.cs

Acknowledgements

Original : https://github.com/wertrain/command-line-parser-cs

About

Easy-to-use command line parser for .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages