igr
igr

Reputation: 10604

Run IntelliJ code formatter from the command line

I am trying to run IntelliJ code formatter from command line.

I know that inspections can be run from CLI, however, they didn't provide the same for the source formatting (lame!).

Now, I started with CE edition of IntelliJ. Source code is on github.

However, since the code base is not small, I am having problems encapsulating the formatter.

Is there anyone who can point me in right direction and showing which classes to start with?

Upvotes: 5

Views: 3510

Answers (2)

Robert
Robert

Reputation: 56

You can run the formatter from the terminal now. Latest link: https://www.jetbrains.com/help/idea/command-line-formatter.html

Upvotes: 3

Mox
Mox

Reputation: 2463

To do this in the new versions of Intellij

You need to make sure the command line launcher is installed via the Jetbrain Toolbox.

Toolbox App Announcement

And run the following command from your shell:

idea format -s /path/to/your/style.xml /path/to/your/folder

I would recommend that you set the shell script location to /usr/local/bin/

Upvotes: 4

Related Questions