Implement --version switch

This commit is contained in:
Hackerpilot 2014-09-15 22:19:33 -07:00
parent 5da79d744e
commit d270b052ec
1 changed files with 12 additions and 1 deletions

View File

@ -59,6 +59,7 @@ int run(string[] args)
bool report; bool report;
string symbolName; string symbolName;
string configLocation; string configLocation;
bool printVersion;
try try
{ {
@ -68,7 +69,8 @@ int run(string[] args)
"ast|xml", &ast, "imports|i", &imports, "outline|o", &outline, "ast|xml", &ast, "imports|i", &imports, "outline|o", &outline,
"tokenDump", &tokenDump, "styleCheck|S", &styleCheck, "tokenDump", &tokenDump, "styleCheck|S", &styleCheck,
"defaultConfig", &defaultConfig, "declaration|d", &symbolName, "defaultConfig", &defaultConfig, "declaration|d", &symbolName,
"config", &configLocation, "report", &report,"muffinButton", &muffin); "config", &configLocation, "report", &report,
"version", &printVersion, "muffinButton", &muffin);
} }
catch (ConvException e) catch (ConvException e)
{ {
@ -97,6 +99,12 @@ int run(string[] args)
return 0; return 0;
} }
if (printVersion)
{
writeln("v0.1.0");
return 0;
}
auto optionCount = count!"a"([sloc, highlight, ctags, tokenCount, auto optionCount = count!"a"([sloc, highlight, ctags, tokenCount,
syntaxCheck, ast, imports, outline, tokenDump, styleCheck, defaultConfig, syntaxCheck, ast, imports, outline, tokenDump, styleCheck, defaultConfig,
report, symbolName !is null]); report, symbolName !is null]);
@ -310,6 +318,9 @@ options:
--help | -h --help | -h
Prints this help message Prints this help message
--version
Prints the program version
--sloc | -l [sourceFiles] --sloc | -l [sourceFiles]
Prints the number of logical lines of code in the given Prints the number of logical lines of code in the given
source files. If no files are specified, input is read from stdin. source files. If no files are specified, input is read from stdin.