Skip to content

Parsing options

Matthias Beerens edited this page Nov 5, 2019 · 1 revision

It is possible to configure how the parser behaves using CommandLineParserOptions.

Example

using MatthiWare.CommandLine;

static void Main(string[] args)
{
    var options = new CommandLineParserOptions
    {
        AppName = "CLI.Tutorial", // Will be used in case of help or error message
        PrefixShortOption = "/", // Required prefix for the short version of the option
        PrefixLongOption = "--", // Required prefix for the long version of the option
        PostfixOption = "=" // Postfix options are optional 
    };

    var parser = new CommandLineParser(options);

    // Further configuration
}

Usage

> Example.exe /opt="My String" /flag --longOption=1
Clone this wiki locally