Skip to content

Commit

Permalink
Merge pull request #259 from s-trooper/fix-143
Browse files Browse the repository at this point in the history
Fix 143
  • Loading branch information
nojaf committed Jun 29, 2018
2 parents 94d6212 + d4ca322 commit 479b8ed
Show file tree
Hide file tree
Showing 7 changed files with 506 additions and 21 deletions.
4 changes: 4 additions & 0 deletions src/Fantomas.Cmd/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let [<Literal>] stdOutText = " Write the formatted source code to standard outpu
let [<Literal>] indentText = "Set number of spaces for indentation (default = 4). The value should be between 1 and 10."
let [<Literal>] widthText = "Set the column where we break to new lines (default = 80). The value should be at least 60."

let [<Literal>] preserveEOLText = "Preserve original end of lines, disables auto insert/remove of blank lines (default = false)"
let [<Literal>] semicolonEOLText = "Enable semicolons at the end of line (default = false)."
let [<Literal>] argumentText = "Disable spaces before the first argument of functions when there are parenthesis (default = true). For methods and constructors, there are never spaces regardless of this option."
let [<Literal>] colonText = "Disable spaces before colons (default = true)."
Expand Down Expand Up @@ -108,6 +109,7 @@ let main _args =
let indent = ref 4
let pageWidth = ref 80

let preserveEOL = ref false
let semicolonEOL = ref false
let spaceBeforeArgument = ref true
let spaceBeforeColon = ref true
Expand Down Expand Up @@ -225,6 +227,7 @@ let main _args =
ArgInfo("--indent", ArgType.Int handleIndent, indentText);
ArgInfo("--pageWidth", ArgType.Int handlePageWidth, widthText);

ArgInfo("--preserveEOL", ArgType.Set preserveEOL, preserveEOLText)
ArgInfo("--semicolonEOL", ArgType.Set semicolonEOL, semicolonEOLText);
ArgInfo("--noSpaceBeforeArgument", ArgType.Clear spaceBeforeArgument, argumentText);
ArgInfo("--noSpaceBeforeColon", ArgType.Clear spaceBeforeColon, colonText);
Expand All @@ -242,6 +245,7 @@ let main _args =
{ FormatConfig.Default with
IndentSpaceNum = !indent;
PageWidth = !pageWidth;
PreserveEndOfLine = !preserveEOL;
SemicolonAtEndOfLine = !semicolonEOL;
SpaceBeforeArgument = !spaceBeforeArgument;
SpaceBeforeColon = !spaceBeforeColon;
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas.Tests/Fantomas.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<Compile Include="VerboseSyntaxConversionTests.fs" />
<Compile Include="FormattingSelectionTests.fs" />
<Compile Include="FormattingSelectionOnlyTests.fs" />
<Compile Include="PreserveEOLTests.fs" />
<Compile Include="ValidationTests.fs" />
<Compile Include="FormattingPropertyTests.fs" />
<Compile Include="SpecialConstructsTests.fs" />
Expand Down
Loading

0 comments on commit 479b8ed

Please sign in to comment.