Skip to content

AtleX.CommandLineArguments is a helper library to facilitate parsing command line arguments into a strongly-typed object

License

Notifications You must be signed in to change notification settings

akamsteeg/AtleX.CommandLineArguments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AtleX.CommandLineArguments

AtleX.CommandLineArguments is a helper library to facilitate parsing command line arguments into a strongly-typed object. Values can be validated with extensible and customisable validators and the library can automatically generate help for the user.

Supported .NET frameworks:

  • .NET 4.6.1
  • NETSTANDARD 2.0

Installation

AtleX.CommandLineArguments is available as NuGet package:

install-package AtleX.CommandLineArguments -Pre

Documentation

See the Wiki for documentation. Use Getting started to get going.

Example

public class Program
{
	private class MyArgumentsClass : Arguments
	{
		[Required]
		[Display(Description = "This text will be displayed in the help, when requested")]
		public bool Argument1
		{
			get;
			set;
		}

		[Display(Description = "This text will be displayed in the help, when requested")]
		public string Name // Not required
		{
			get;
			set;
		}
	}
	
	static void Main(string[] args)
	{
		MyArgumentsClass cliArguments;
		if (!CommandLineArguments.TryParse<MyArgumentsClass>(args, out cliArguments))
		{
			// Something wrong, exit or display help?
			CommandLineArguments.DisplayHelp(cliArguments);
			return;
		}

		if (cliArguments.Argument1)
		{
		
		}
	}
}

License

AtleX.CommandLineArguments uses the MIT license, see the LICENSE file.