Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simple yet powerfull library to made parsing CLI arguments easy. Library also allow to print usage help "out of box".

License

NotificationsYou must be signed in to change notification settings

bartoszgolek/NFlags

Repository files navigation

Build StatusNuGetLicense

Simple yet powerfull library to made parsing CLI arguments easy.Library also allow to print usage help and application version "out of box".

For example of usage checkExamples directory.

QuickStart

  1. Install NFLags from NuGet.
  2. Start new console project.
  3. Configure NFLags:
Cli.Configure(configure=>configure.SetDialect(Dialect.Gnu).SetName("QuickStart").SetDescription("This is NFlags").EnableVersionOption()).Root(rc=>rc.RegisterFlag("flag1","f","Flag description",false).RegisterOption("option","o","Option description","optionDefaultValue").RegisterParameter("param","Param description","ParamDefaultValue").RegisterCommand("subcommand","Subcommand Description", sc=>sc.SetExecute((commandArgs,output)=>output.WriteLine("This is subcommand: "+commandArgs.GetParameter<string>("SubParameter"))).RegisterParameter("SubParameter","SubParameter description","SubParameterValue")).RegisterParamSeries("paramSeries","paramSeriesDescription").SetExecute((commandArgs,output)=>output.WriteLine("This is root command: "+commandArgs.GetParameter<string>("param")))).Run(args);

Run application and enjoy:

$> dotnet NFlags.QuickStart.dllThis is root command: ParamDefaultValue%$> dotnet NFlags.QuickStart.dll xxxThis is root command: xxx$> dotnet NFlags.QuickStart.dll --helpUsage:        QuickStart [COMMAND] [OPTIONS]... [PARAMETERS]...This is NFlags        Commands:        command Sub command Description        Parameters:        <param> Param description (Default: 'ParamDefaultValue')        <paramSeries...>        paramSeriesDescription        Options:        --flag1, -f     Flag description        --option <option>, -o <option>  Option description (Default: 'optionDefaultValue')        --help, -h      Prints this help        --version, -v      Prints application version$> dotnet NFlags.QuickStart.dll subcommandThis is subcommand: SubParameterValue$> dotnet NFlags.QuickStart.dll subcommand yyyThis is subcommand: yyy$> dotnet NFlags.QuickStart.dll command --helpUsage:        QuickStart command [OPTIONS]... [PARAMETERS]...This is NFlags        Parameters:        <Parameter>     Sub parameter description (Default: 'SubParameterValue')        Options:        --help, -h      Prints this help        --version, -v      Prints application version$>

Documentation

See details on NFlags GitHub pages

About

Simple yet powerfull library to made parsing CLI arguments easy. Library also allow to print usage help "out of box".

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp