Just simple command line parser
- Command line parsing
- Activating functions via delegate
- Easy to use
dotnet add package NeoSimpleCommandLineParser --version 1.0.0
Add the SCLP
namespace to your project. No external packages required
using SCLP; public class Program { private static void Main(string[] args) { var helpOpt = new Option("h", "help", "Show this list", false, null); var echoOpt = new Option("ec","echo","Print your phrase",true, "you phrase"); var callOpt = new Option("cl","call","Print Calling... + your phrase",true, "you phrase"); var sayOpt = new Option("s","say",null); var optionsList = new OptionsList(new Option[] { echoOpt, callOpt, sayOpt, helpOpt }); var root = new Root(args, optionsList); helpOpt.Action += root.PrintHelp; echoOpt.Action += Echo; callOpt.Action += Call; sayOpt.Action += Say; root.ParseOptions(); root.InvokeActions(); } public static void Echo(string[]? arguments) { if (arguments == null) return; foreach (var arg in arguments) Console.WriteLine(arg); } public static void Call(string[]? arguments) { if (arguments == null) return; foreach (var arg in arguments) Console.WriteLine($"Calling... {arg}"); } public static void Say(string[]? arguments) => Console.WriteLine("I just say"); }
We welcome your contributing
- Issues
- Discussions
- Pull requests