Command Line Formatter
Command-line source code formatter is a special functionality within PhpStorm that lets you format arbitrary files outside of a project. So doing, the formatter makes use of XML files with the exported code style settings () and a file specification that defines a file or a group of files to be formatted.
For the files to be formatted there should be corresponding plugins which support the required file types. For example, PHP files will be formatted only if PHP plugin is installed.
Formatter launcher script
The script is
format.bat/format.sh (Windows/Linux,Mac) in
<PhpStorm_HOME>/bin directory, where
<PhpStorm_HOME> is PhpStorm's root installation directory. The script launches PhpStorm, which formats the specified files and quits. If launched without any parameters or with
-h parameter, the script outputs a list of its options.
|Shows a help message and quits.|
|Scans directories specified in |
|A comma-separated list of file masks, which define the files to be processed. The wildcard characters |
|A path to a file or a directory to be processed.|
1. Format all the files in
C:\Data\src directory, including all subdirectories, using the default code style settings:
format -r C:\Data\src
2. Non-recursively format all
.html files in
C:\Data\src directory, using code style settings from
format -s C:\Data\settings.xml -m * .java,*.html C:\Data\src