Terse syntax C# command line parser for .NET with F# support
Memo.
コマンドラインパーサー。
パース設定:
class Options {
[Option('r', "read", Required = true,
HelpText = "Input files to be processed.")]
public IEnumerable InputFiles { get; set; }
// Omitting long name, default --verbose
[Option(
HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
[Option(Default = "中文",
HelpText = "Content language.")]
public string Language { get; set; }
[Value(0, MetaName = "offset",
HelpText = "File offset.")]
public long? Offset { get; set; }
}
パース:
static int Main(string[] args) {
var options = new Options();
var isValid = CommandLine.Parser.Default.ParseArgumentsStrict(args, options);
}
[amazonjs asin=”4873116503″ locale=”JP” tmpl=”Small” title=”プログラミングC# 第7版”]
コメント