2.066.1 compatability
This commit is contained in:
parent
bea04c3919
commit
75da67c296
src/dfmt
|
@ -24,29 +24,74 @@ else
|
|||
{
|
||||
int main(string[] args)
|
||||
{
|
||||
import std.getopt : getopt, defaultGetoptPrinter;
|
||||
|
||||
bool inplace = false;
|
||||
Config config;
|
||||
auto getOptResult = getopt(args,
|
||||
"inplace", "Modify files in-place", &inplace,
|
||||
"tabs|t", getHelp!(Config.useTabs), &config.useTabs,
|
||||
"braces", getHelp!(Config.braceStyle), &config.braceStyle,
|
||||
"colSoft", getHelp!(Config.columnSoftLimit), &config.columnSoftLimit,
|
||||
"colHard", getHelp!(Config.columnHardLimit), &config.columnHardLimit,
|
||||
"tabSize", getHelp!(Config.tabSize), &config.tabSize,
|
||||
"indentSize", getHelp!(Config.indentSize), &config.indentSize,
|
||||
"alignSwitchCases", getHelp!(Config.alignSwitchStatements), &config.alignSwitchStatements,
|
||||
"outdentLabels", getHelp!(Config.outdentLabels), &config.outdentLabels,
|
||||
"outdentAttributes", getHelp!(Config.outdentAttributes), &config.outdentAttributes,
|
||||
"splitOperatorAtEnd", getHelp!(Config.splitOperatorAtEnd), &config.splitOperatorAtEnd,
|
||||
"spaceAfterCast", getHelp!(Config.spaceAfterCast), &config.spaceAfterCast,
|
||||
"newlineType", getHelp!(Config.newlineType), &config.newlineType);
|
||||
|
||||
if (getOptResult.helpWanted)
|
||||
static if (__VERSION__ >= 2067)
|
||||
{
|
||||
defaultGetoptPrinter("dfmt 0.3.0-dev\nOptions:", getOptResult.options);
|
||||
return 0;
|
||||
import std.getopt : getopt, defaultGetoptPrinter;
|
||||
auto getOptResult = getopt(args,
|
||||
"inplace", "Modify files in-place", &inplace,
|
||||
"tabs|t", getHelp!(Config.useTabs), &config.useTabs,
|
||||
"braces", getHelp!(Config.braceStyle), &config.braceStyle,
|
||||
"colSoft", getHelp!(Config.columnSoftLimit), &config.columnSoftLimit,
|
||||
"colHard", getHelp!(Config.columnHardLimit), &config.columnHardLimit,
|
||||
"tabSize", getHelp!(Config.tabSize), &config.tabSize,
|
||||
"indentSize", getHelp!(Config.indentSize), &config.indentSize,
|
||||
"alignSwitchCases", getHelp!(Config.alignSwitchStatements), &config.alignSwitchStatements,
|
||||
"outdentLabels", getHelp!(Config.outdentLabels), &config.outdentLabels,
|
||||
"outdentAttributes", getHelp!(Config.outdentAttributes), &config.outdentAttributes,
|
||||
"splitOperatorAtEnd", getHelp!(Config.splitOperatorAtEnd), &config.splitOperatorAtEnd,
|
||||
"spaceAfterCast", getHelp!(Config.spaceAfterCast), &config.spaceAfterCast,
|
||||
"newlineType", getHelp!(Config.newlineType), &config.newlineType);
|
||||
|
||||
if (getOptResult.helpWanted)
|
||||
{
|
||||
defaultGetoptPrinter("dfmt 0.3.0-dev\n\nOptions:", getOptResult.options);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
import std.getopt : getopt;
|
||||
bool showHelp;
|
||||
getopt(args,
|
||||
"help|h", &showHelp,
|
||||
"inplace", &inplace,
|
||||
"tabs|t", &config.useTabs,
|
||||
"braces", &config.braceStyle,
|
||||
"colSoft", &config.columnSoftLimit,
|
||||
"colHard", &config.columnHardLimit,
|
||||
"tabSize", &config.tabSize,
|
||||
"indentSize", &config.indentSize,
|
||||
"alignSwitchCases", &config.alignSwitchStatements,
|
||||
"outdentLabels", &config.outdentLabels,
|
||||
"outdentAttributes", &config.outdentAttributes,
|
||||
"splitOperatorAtEnd", &config.splitOperatorAtEnd,
|
||||
"spaceAfterCast", &config.spaceAfterCast,
|
||||
"newlineType", &config.newlineType);
|
||||
if (showHelp)
|
||||
{
|
||||
writeln(`dfmt 0.3.0-dev
|
||||
|
||||
Options:
|
||||
--help | -h Print this help message
|
||||
--inplace Edit files in place
|
||||
--tabs | -t Use tabs instead of spaces
|
||||
--braces Brace style can be 'otbs', 'allman', or 'stroustrup'
|
||||
--colSoft Column soft limit
|
||||
--colHard Column hard limit
|
||||
--tabSize Size of tabs
|
||||
--indentSize Number of spaces used for indentation
|
||||
--alignSwitchCases Align cases, defaults, and labels with enclosing
|
||||
switches
|
||||
--outdentLabels Outdent labels
|
||||
--outdentAttributes Outdent attribute declarations
|
||||
--splitOperatorAtEnd Place operators at the end of the previous line when
|
||||
wrapping
|
||||
--spaceAfterCast Insert spaces after cast expressions
|
||||
--newlineType Newline type can be 'cr', 'lf', or 'crlf'`);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.isValid())
|
||||
|
|
Loading…
Reference in New Issue