Change to more effcient optionsToString template
This commit is contained in:
parent
06d58ff83a
commit
4f7f37d664
|
@ -289,20 +289,19 @@ private version (Windows)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string optionsToString(E)() if (is(E == enum))
|
template optionsToString(E) if (is(E == enum))
|
||||||
{
|
{
|
||||||
import std.traits : EnumMembers;
|
enum optionsToString = () {
|
||||||
import std.conv : to;
|
|
||||||
|
|
||||||
string result = "(";
|
string result = "(";
|
||||||
foreach (i, option; EnumMembers!E)
|
foreach (s; [__traits(allMembers, E)])
|
||||||
{
|
{
|
||||||
immutable s = to!string(option);
|
if (s != "unspecified")
|
||||||
if (s != "unspecified")
|
result ~= s ~ "|";
|
||||||
result ~= s ~ "|";
|
}
|
||||||
}
|
result = result[0 .. $ - 1] ~ ")";
|
||||||
result = result[0 .. $ - 1] ~ ")";
|
return result;
|
||||||
return result;
|
} ();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printHelp()
|
private void printHelp()
|
||||||
|
@ -318,12 +317,12 @@ Options:
|
||||||
|
|
||||||
Formatting Options:
|
Formatting Options:
|
||||||
--align_switch_statements
|
--align_switch_statements
|
||||||
--brace_style `, optionsToString!(typeof(Config.dfmt_brace_style))(),
|
--brace_style `, optionsToString!(typeof(Config.dfmt_brace_style)),
|
||||||
`
|
`
|
||||||
--end_of_line `, optionsToString!(typeof(Config.end_of_line))(), `
|
--end_of_line `, optionsToString!(typeof(Config.end_of_line)), `
|
||||||
--indent_size
|
--indent_size
|
||||||
--indent_style, -t `,
|
--indent_style, -t `,
|
||||||
optionsToString!(typeof(Config.indent_style))(), `
|
optionsToString!(typeof(Config.indent_style)), `
|
||||||
--soft_max_line_length
|
--soft_max_line_length
|
||||||
--max_line_length
|
--max_line_length
|
||||||
--outdent_attributes
|
--outdent_attributes
|
||||||
|
@ -334,7 +333,7 @@ Formatting Options:
|
||||||
--compact_labeled_statements
|
--compact_labeled_statements
|
||||||
--template_constraint_style
|
--template_constraint_style
|
||||||
`,
|
`,
|
||||||
optionsToString!(typeof(Config.dfmt_template_constraint_style))());
|
optionsToString!(typeof(Config.dfmt_template_constraint_style)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string createFilePath(bool readFromStdin, string fileName)
|
private string createFilePath(bool readFromStdin, string fileName)
|
||||||
|
|
Loading…
Reference in New Issue