Format files from the command line
Apply code style formatting to specified files from the command line. To be able to format files, install and enable plugins with support for the corresponding file types in DataGrip (for example, the Shell Script plugin to format shell script files).
- Syntax
- datagrip.bat format [<options>] <path ...>
- Examples
-
Format two specific files from the C:\Data\src directory using the default code style settings:
datagrip.bat format C:\Data\src\hello.html C:\Data\src\world.htmlRecursively format all files in the C:\Data\src directory including all subdirectories using the default code style settings:
datagrip.bat format -r C:\Data\srcNon-recursively format all the .xml and .html files in the C:\Data\src directory using code style settings from C:\Data\settings.xml:
datagrip.bat format -s C:\Data\settings.xml -m *.xml,*.html C:\Data\src
- Syntax
- datagrip format [<options>] <path ...>
- Examples
-
Format two specific files from the ~/Data/src directory using the default code style settings:
datagrip format ~/Data/src/hello.html ~/Data/src/world.htmlRecursively format all files in the ~/Data/src directory including all subdirectories using the default code style settings:
datagrip format -r ~/Data/srcNon-recursively format all the .xml and .html files in the ~/Data/src directory using code style settings from ~/Data/settings.xml:
datagrip format -s ~/Data/settings.xml -m *.xml,*.html ~/Data/src
- Syntax
- datagrip.sh format [<options>] <path ...>
- Examples
-
Format two specific files from the ~/Data/src directory using the default code style settings:
datagrip.sh format ~/Data/src/hello.html ~/Data/src/world.htmlRecursively format all files in the ~/Data/src directory including all subdirectories using the default code style settings:
datagrip.sh format -r ~/Data/srcNon-recursively format all the .xml and .html files in the ~/Data/src directory using code style settings from ~/Data/settings.xml:
datagrip.sh format -s ~/Data/settings.xml -m *.xml,*.html ~/Data/src