例) カレントディレクトリ配下の*.javaに対して適用
-> % /Applications/eclipse/eclipse -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config xxxxxxx/.settings/org.eclipse.jdt.core.prefs `find $(pwd) -name '*.java'`
フォーマット対象ファイルはフルパスじゃないとダメみたいです。
あと、対象外ファイルはgrep -v
とかで除けるかと。
使用方法
Usage: eclipse -application org.eclipse.jdt.core.JavaCodeFormatter [ OPTIONS ] -config <configFile> <files>
<files> Java source files and/or directories to format.
Only files ending with .java will be formatted in the given directory.
-config <configFile> Use the formatting style from the specified properties file.
Refer to the help documentation to find out how to generate this file.
OPTIONS:
-help Display this message.
-quiet Only print error messages.
-verbose Be verbose about the formatting job.