forked from scala-ide/scalariform
-
Notifications
You must be signed in to change notification settings - Fork 31
Command line tool
mdr edited this page May 7, 2012
·
10 revisions
Scalariform can be used as a stand-alone command-line utility.
You can download the executable JAR from here: scalariform.jar
java -jar scalariform.jar
Or you place it in your $PATH and invoke it directly:
chmod u+x scalariform.jar
scalariform --help
Usage: scalariform [options] [files...]
Options:
--encoding=<encoding> Set the encoding, e.g. UTF-8. If not set, defaults to the platform default encoding (currently UTF-8).
--fileList=<path>, -l=<path> Read the list of input file(s) from a text file (one per line)
--forceOutput, -f If using --stdout, print the source unchanged if it cannot be parsed correctly.
--help, -h Show help
--preferenceFile=<path>, -p=<path> Read preferences from a properties file
--recurse, -r If any given file is a directory, recurse beneath it and collect all .scala files for processing
--scalaVersion=<v>, -s=<v> Assume the source is written against the given version of Scala (e.g. 2.9.2). Default is runtime version (currently 2.9.2).
--stdin Read Scala source from standard input
--stdout Write the formatted output to standard output
--test, -t Check the input(s) to see if they are correctly formatted, return a non-zero error code if not.
--verbose, -v Verbose output
--version Show Scalariform version
Preferences:
[+|-]alignParameters Enable/disable Align parameters on different lines in the same column
[+|-]alignSingleLineCaseStatements Enable/disable Align the arrows of consecutive single-line case statements
[+|-]compactControlReadability Enable/disable Enable Compact Control Readability style
[+|-]compactStringConcatenation Enable/disable Omit spaces when formatting a '+' operator on String literals
[+|-]doubleIndentClassDeclaration Enable/disable Double indent either a class's parameters or its inheritance list
[+|-]formatXml Enable/disable Format XML literals
[+|-]indentLocalDefs Enable/disable Indent local defs an extra level
[+|-]indentPackageBlocks Enable/disable Indent package blocks
[+|-]indentWithTabs Enable/disable Use a tab character for indentation
[+|-]multilineScaladocCommentsStartOnFirstLine Enable/disable Start multiline Scaladoc comment body on same line as the opening '/**'
[+|-]placeScaladocAsterisksBeneathSecondAsterisk Enable/disable Place Scaladoc asterisks beneath the second asterisk in the opening '/**', as opposed to the first
[+|-]preserveDanglingCloseParenthesis Enable/disable Allow a newline before a ')' in an argument expression
[+|-]preserveSpaceBeforeArguments Enable/disable Preserve a space before a parenthesis argument
[+|-]rewriteArrowSymbols Enable/disable Replace arrow tokens with unicode equivalents: => with ⇒, and <- with ←
[+|-]spaceBeforeColon Enable/disable Add a space before colons
[+|-]spaceInsideBrackets Enable/disable Require a space after '[' and before ']'
[+|-]spaceInsideParentheses Enable/disable Require a space after '(' and before ')'
[+|-]spacesWithinPatternBinders Enable/disable Add a space around the @ token in pattern binders
-alignSingleLineCaseStatements.maxArrowIndent=[1-100] Set Maximum number of spaces inserted before an arrow to align case statements
-indentSpaces=[1-10] Set Number of spaces to use for indentation
Examples:
scalariform +spaceBeforeColon -alignParameters -indentSpaces=2 foo.scala
find . -name '*.scala' | xargs scalariform +rewriteArrowSymbols --verbose --test
echo 'class A ( n :Int )' | scalariform --stdin --stdout
- Home - Overview of Scalariform
- Command-line tool
- Maven plugin
- Library
- Formatter preferences