Home Advanced usage Custom Format
Post
Cancel

Custom Format

The format is the definition of the prefix for long name and short name of arguments, and the assignation character for setting a value to an argument, this character or symbol is usually located between the argument key and the value, --arg-key=value.

Native Format

The default native format is --long-argument-name argValue -short-name value --option.

Custom Format

The customize the input format you can create your own format class by implementing the base class CliArgsFormat.

1
2
3
4
public class CustomFormat : CliArgsFormat
    {
        public CustomFormat() : base(':', "/:", "/") { }
    }

Then from main specify the Input format to use during the initialization:

1
AppCliArgs.Initialize<CliArgsSetup>(new CustomFormat());

Other easy way to do is by creating a new instance from the default format and set the arguments from constructor:

1
2
// /:long-name=vlaue /short=other-value
AppCliArgs.Initialize<CliArgsSetup>(new CliArgsFormat('=', "/:", "/"));