Formatting files from command line
Command-line source code formatter is a special functionality within AppCode that lets you format arbitrary files outside a project.
- In the command line, run
formatcommand the using the following syntax:format [-h] [-r|-R] [-s|-settings settingsPath] [-m|-mask masks] path1 [path2...]
The command launches AppCode, which formats the specified files and then quits.
The command options are as follows:
| || |
The full path to the format.sh script located in the <IDE_HOME>/bin directory.
(optional) Show the help message and quit.
(optional) Scan directories specified in
| || (optional) Format code according to the code style settings file provided in the |
If the parameter is omitted, the default code style settings will be used.
(optional) A comma-separated list of file masks that define the files to be processed. The
The path to a file or directory to be processed.
Format all files in the ~/MyProject/src directory including all subdirectories using the default code style settings:<IDE_HOME>/bin/format.sh -r ~/MyProject/src
Non-recursively format all the .xml and .html files in the ~/MyProject/src directory using code style settings from ~/Data/settings.xml:<IDE_HOME>/bin/format.sh -s ~/Data/settings.xml -m * .xml,*.html ~/MyProject/src