Merge pull request #193 from UplinkCoder/master

add printOption to help
This commit is contained in:
Brian Schott 2015-12-09 12:47:32 -08:00
commit 43aa8437ba
1 changed files with 13 additions and 2 deletions

View File

@ -157,6 +157,17 @@ else
} }
} }
private string optionsToString(E)() if(is(E == enum)) {
import std.traits:EnumMembers;
import std.conv;
string result = "[";
foreach(i, option; EnumMembers!E) {
result ~= to!string(option) ~ "|";
}
result = result[0 .. $-1] ~ "]";
return result;
}
private void printHelp() private void printHelp()
{ {
writeln(`dfmt `, VERSION, ` writeln(`dfmt `, VERSION, `
@ -169,11 +180,11 @@ Options:
Formatting Options: Formatting Options:
--align_switch_statements --align_switch_statements
--brace_style --brace_style `, optionsToString!(typeof(Config.dfmt_brace_style))(), `
--end_of_line --end_of_line
--help|h --help|h
--indent_size --indent_size
--indent_style|t --indent_style|t `, optionsToString!(typeof(Config.indent_style))(), `
--soft_max_line_length --soft_max_line_length
--max_line_length --max_line_length
--outdent_attributes --outdent_attributes