Menu

FormatterCommandLine

Ernest

Running FlexFormatter from the Command Line

You can run FlexFormatter from the command line for batch formatting.

Pros

  • Better performance - while you can use the context menu on a Project or folder in Eclipse to run the formatter, that requires opening the file, operating on it, and closing it. This adds considerable overhead.
  • You can operate on files that aren't part of an open FlexBuilder project

Cons

  • If you operate from the command line on a FlexBuilder project, you may cause breakpoints and other line markers to be lost or shifted to incorrect positions

Instructions

  1. Download the .zip file command line support jars from here: | CommandLineSupportJars
  2. Download the desired version of the FlexFormatter distribution.
  3. Create a directory on your hard disk, and extract the contents of both zip files into that directory
  4. From a shell, issue a command similar to the following:
    1. java -Djava.ext.dirs=. utilities.CommandLine c:\sourceDir c:\tools\Formatter.properties 4 true
    2. c:\sourceDir -> the root directory where your source files are located. Everything underneath is formatted recursively. Or, you can specify the path to a single file, in which case that will be the only file processed.
    3. c:\tools\Formatter.properties -> the properties to use for formatting, as saved out from the FlexFormatter preference page, with the Export button
    4. Note: if you want to use the mxml formatter on different file extensions, add the following property to the end of the file: MXML.additionalXMLExtensions=xxx,yyy (where after the '=' is a comma-separated lower-case list of file extensions)
    5. 4 -> The size of a tab character, in spaces
    6. true -> if true, then format, otherwise indent

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.