Subversion Repository Public Repository

ChrisCompleteCodeTrunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Command Line Parser Library 1.9.71.2 stable
------------------------------------------
Giacomo Stelluti Scala
(gsscoder@gmail.com)

GitHub (Latest Sources, Updated Docs): https://github.com/gsscoder/commandline
Codeplex (Binary Downloads): http://commandline.codeplex.com/

Remarks:
 - IParser and IParserSettings interface were removed.

Upgrading from < 1.9.6.1 rc1:
-----------------------------
Now CommandLine.Parser is defiend as:
interface CommandLine.Parser {
  bool ParseArguments(string[] args, object options);
  bool ParseArguments(string[] args, object options, Action<string, object> onVerbCommand);
  bool ParseArgumentsStrict(string[] args, object options, Action onFail = null);
  bool ParseArgumentsStrict(string[] args, object options, Action<string, object> onVerbCommand, Action onFail = null);
}
Please refer to wiki (https://github.com/gsscoder/commandline/wiki).
For help screen in verb command scenario use new HelpText::AutoBuild(object,string).

Upgrading from < 1.9.4.91 versions:
-----------------------------------
- Use System.Char for short name:
  [Option('o', "my-option", DefaultValue=10, HelpText="This is an option!")]
  public int MyOption { get; set; }
- Receive parsing errors without CommandLineOptionsBase (removed):
  public class Options {
    [ParserState]
    public IParserState LastParserState { get; set; }
  }
- Types rename:
  MultiLineTextAttribute -> MultilineTextAttribute (first 'L' -> lowercase)
  CommandLineParser -> Parser (suggestion: qualify with namespace -> CommandLine.Parser).
  ICommandLineParser -> IParser
  CommandLineParserSettings -> ParserSettings
  CommandLineParserException -> ParserException

Upgrading from 1.8.* versions:
------------------------------
The major API change is that all attributes that inherits from BaseOptionAttribute now
apply only to properties. Fields are no longer supported.

Old Code:
---------
class Options {
  [Option("o", "my-option", HelpText="This is an option!")]
  public int MyOption = 10;
}

New Code:
---------
class Options {
  [Option("o", "my-option", DefaultValue=10, HelpText="This is an option!")]
  public int MyOption { get; set; }
}

As you can see I've added the new DefaultValue property to help you initialize properties.

Shortcut for Help Screen
------------------------
[HelpOption]
public string GetUsage()
{
  return HelpText.AutoBuild(this,
    (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
}

Note:
-----
If you don't use mutually exclusive options, now there's a singleton built for common uses:

if (CommandLineParser.Default.ParseArguments(args, options)) {
  // consume values here
}

Have fun!

Commits for ChrisCompleteCodeTrunk/PremierMigration/packages/CommandLineParser.1.9.71/readme.txt

Diff revisions: vs.
Revision Author Commited Message
1 BBDSCHRIS picture BBDSCHRIS Wed 22 Aug, 2018 20:08:03 +0000