CommandLineUtils
CommandLineUtils is a library which helps developers implement command line applications in .NET. The primary goal of the library is to assist with parsing command line arguments and executing the correct commands related to those arguments. The library also provides various other utilities such as input helpers.
Documentation
Tutorials to create your first .NET command line application, and docs on how to use the library.
API Reference
Read the API documentation for this library.
Samples
View sample projects which use CommandLineUtils.
Source Code
The project is open-source on GitHub.
NuGet
See the latest releases of this library as a NuGet package.
Changelog
Read notes about fixes and enhancements per release.
Quick Example
Using this library, you can write a command line application without doing the heavy lifting to support automated help text generation, masking input for passwords, parsing argument syntax, validation, etc.
using McMaster.Extensions.CommandLineUtils;
using System;
using System.ComponentModel.DataAnnotations;
class Program
{
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
[Option("-n")]
[Range(0, 10)]
[Required]
public int Count { get; }
public void OnExecute()
{
for (var i = 0; i < Count; i ++)
{
Prompt.GetPassword("Enter your password: ");
}
}
}