1using System.Collections.Generic;
9using System.Reflection;
24 var args =
"--exclude=a,b InputFile.txt".Split();
26 Excluded =
new[] {
"a",
"b" },
27 Included = Enumerable.Empty<
string>(),
28 InputFileName =
"InputFile.txt",
30 var sut =
new Parser(parserSettings => { parserSettings.GetoptMode = useGetoptMode; });
42 var args =
new[] {
"--configure-profile",
"deploy",
"--profile",
"local" };
43 var expected =
new Options_With_Similar_Names { ConfigureProfile =
"deploy", Profile =
"local", Deploys = Enumerable.Empty<
string>() };
44 var sut =
new Parser(parserSettings => { parserSettings.GetoptMode = useGetoptMode; });
55 var args =
new[] {
"c",
"x,y" };
61 .Select(sp => sp.Specification)
65 var tokens = tokenizerResult.SucceededWith();
66 tokens.Should().BeEquivalentTo(tokensExpected);
76 var args =
"-c chanA:chanB file.hdf5".Split();
78 Channels =
new[] {
"chanA",
"chanB" },
79 ArchivePath =
"file.hdf5",
81 var sut =
new Parser(parserSettings => { parserSettings.GetoptMode = useGetoptMode; });
94 var args =
new[] {
"-a",
"1,2",
"c" };
96 var sut =
new Parser(parserSettings => { parserSettings.GetoptMode = useGetoptMode; });
109 var args =
"--fm D,C a.txt".Split();
111 Mode =
new[] {
FMode.D, FMode.C },
112 Files =
new[] {
"a.txt" },
114 var sut =
new Parser(parserSettings => { parserSettings.GetoptMode = useGetoptMode; });
127 var args =
"--outdir ./x64/Debug --modules ../utilities/x64/Debug,../auxtool/x64/Debug m_xfunit.f03 m_xfunit_assertion.f03".Split();
129 OutDir =
"./x64/Debug",
130 ModuleDirs =
new[] {
"../utilities/x64/Debug",
"../auxtool/x64/Debug" },
131 Ignores = Enumerable.Empty<
string>(),
132 Srcs =
new[] {
"m_xfunit.f03",
"m_xfunit_assertion.f03" },
134 var sut =
new Parser(parserSettings => { parserSettings.GetoptMode = useGetoptMode; });
The Maybe type models an optional value. A value of type Maybe a either contains a value of type a (r...
static Specification FromProperty(PropertyInfo property)
static SpecificationProperty Create(Specification specification, PropertyInfo property, Maybe< object > value)
static Token Value(string text)
static Func< IEnumerable< string >, IEnumerable< OptionSpecification >, Result< IEnumerable< Token >, Error > > ConfigureTokenizer(StringComparer nameComparer, bool ignoreUnknownArguments, bool enableDashDash)
It contains an instance of type T with parsed values.
Provides methods to parse command line arguments.
ParserResult< object > ParseArguments(IEnumerable< string > args, params Type[] types)
Parses a string array of command line arguments for verb commands scenario, constructing the proper i...
static void Enumerable_with_separator_before_values_does_not_try_to_parse_too_much(bool useGetoptMode)
static void Values_with_same_name_as_sequence_option_do_not_cause_later_values_to_split_on_separators()
static void Enumerable_with_colon_separator_before_values_does_not_try_to_parse_too_much(bool useGetoptMode)
static void Enumerable_before_values_does_not_try_to_parse_too_much(bool useGetoptMode)
static void Separator_just_before_values_does_not_try_to_parse_values(bool useGetoptMode)
static void Options_with_similar_names_are_not_ambiguous(bool useGetoptMode)
static void Enumerable_with_enum_before_values_does_not_try_to_parse_too_much(bool useGetoptMode)