-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix enumerable options grabbing too many values
- Loading branch information
Showing
7 changed files
with
339 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
tests/CommandLine.Tests/Fakes/Options_With_Sequence_Having_Separator_And_Values.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace CommandLine.Tests.Fakes | ||
{ | ||
public class Options_For_Issue_91 | ||
{ | ||
[Value(0, Required = true)] | ||
public string InputFileName { get; set; } | ||
|
||
[Option('o', "output")] | ||
public string OutputFileName { get; set; } | ||
|
||
[Option('i', "include", Separator = ',')] | ||
public IEnumerable<string> Included { get; set; } | ||
|
||
[Option('e', "exclude", Separator = ',')] | ||
public IEnumerable<string> Excluded { get; set; } | ||
} | ||
|
||
public class Options_For_Issue_454 | ||
{ | ||
[Option('c', "channels", Required = true, Separator = ':', HelpText = "Channel names")] | ||
public IEnumerable<string> Channels { get; set; } | ||
|
||
[Value(0, Required = true, MetaName = "file_path", HelpText = "Path of archive to be processed")] | ||
public string ArchivePath { get; set; } | ||
} | ||
|
||
public class Options_For_Issue_510 | ||
{ | ||
[Option('a', "aa", Required = false, Separator = ',')] | ||
public IEnumerable<string> A { get; set; } | ||
|
||
[Option('b', "bb", Required = false)] | ||
public string B { get; set; } | ||
|
||
[Value(0, Required = true)] | ||
public string C { get; set; } | ||
} | ||
|
||
public enum FMode { C, D, S }; | ||
|
||
public class Options_For_Issue_617 | ||
{ | ||
[Option("fm", Separator=',', Default = new[] { FMode.S })] | ||
public IEnumerable<FMode> Mode { get; set; } | ||
|
||
[Option('q')] | ||
public bool q { get;set; } | ||
|
||
[Value(0)] | ||
public IList<string> Files { get; set; } | ||
} | ||
|
||
public class Options_For_Issue_619 | ||
{ | ||
[Option("verbose", Required = false, Default = false, HelpText = "Generate process tracing information")] | ||
public bool Verbose { get; set; } | ||
|
||
[Option("outdir", Required = false, Default = ".", HelpText = "Directory to look for object file")] | ||
public string OutDir { get; set; } | ||
|
||
[Option("modules", Required = true, Separator = ',', HelpText = "Directories to look for module file")] | ||
public IEnumerable<string> ModuleDirs { get; set; } | ||
|
||
[Option("ignore", Required = false, Separator = ' ', HelpText = "List of additional module name references to ignore")] | ||
public IEnumerable<string> Ignores { get; set; } | ||
|
||
[Value(0, Required = true, HelpText = "List of source files to process")] | ||
public IEnumerable<string> Srcs { get; set; } | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/CommandLine.Tests/Fakes/Options_With_Similar_Names.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace CommandLine.Tests.Fakes | ||
{ | ||
public class Options_With_Similar_Names | ||
{ | ||
[Option("deploy", Separator = ',', HelpText= "Projects to deploy")] | ||
public IEnumerable<string> Deploys { get; set; } | ||
|
||
[Option("profile", Required = true, HelpText = "Profile to use when restoring and publishing")] | ||
public string Profile { get; set; } | ||
|
||
[Option("configure-profile", Required = true, HelpText = "Profile to use for Configure")] | ||
public string ConfigureProfile { get; set; } | ||
} | ||
|
||
public class Options_With_Similar_Names_And_Separator | ||
{ | ||
[Option('f', "flag", HelpText = "Flag")] | ||
public bool Flag { get; set; } | ||
|
||
[Option('c', "categories", Required = false, Separator = ',', HelpText = "Categories")] | ||
public IEnumerable<string> Categories { get; set; } | ||
|
||
[Option('j', "jobId", Required = true, HelpText = "Texts.ExplainJob")] | ||
public int JobId { get; set; } | ||
} | ||
|
||
} |
Oops, something went wrong.