NFlags
Simple yet powerfull library to made parsing CLI arguments easy. Library also allow to print usage help "out of box".
Install / Use
/learn @bartoszgolek/NFlagsREADME
NFlags
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 check Examples directory.
QuickStart
- Install NFLags from NuGet.
- Start new console project.
- 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.dll
This is root command: ParamDefaultValue%
$> dotnet NFlags.QuickStart.dll xxx
This is root command: xxx
$> dotnet NFlags.QuickStart.dll --help
Usage:
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 subcommand
This is subcommand: SubParameterValue
$> dotnet NFlags.QuickStart.dll subcommand yyy
This is subcommand: yyy
$> dotnet NFlags.QuickStart.dll command --help
Usage:
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
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
