JavaBeautifier 1.0: Command line usage
java com.stevesoft.jbeaut.JavaBeautifier [-tab=number]
[-braces=NextLine|EndOfLine] file(s)
The JavaBeautifier
will beautify the files in place (a copy of the original will
be saved to filename.bak).
Code that looks like this:
if(a)
if(b)
c;
else(d)
e;
if(a) {
while(b) {
c; /*
Here is a table:
+------+------+
| col1 | col2 |
+------+------+
| vol1 | vol2 |
+------+------+
*/
}
}
|
Will be transformed to look like this:
if(a)
if(b)
c;
else(d)
e;
if(a) {
while(b) {
c; /*
Here is a table:
+------+------+
| col1 | col2 |
+------+------+
| vol1 | vol2 |
+------+------+
*/
}
}
|
The text is indented four additional spaces after each "{" and
four fewer spaces after each "}".
Note that while the multi-line comment in the above pseudo
code is indented, it's overall structure is returned. The +
is still aligned under the second "e" in "Here".
Although this is not apparent in the illustration, note that
all tabs are removed from the source file by the beautification
procedure and replaced by spaces.
If the -tab=number option is supplied, then
the default indent will be changed from four
to number spaces.
By default, the JavaBeautifier does not
add any newlines to your code. If this is not the behavior
you desire, you
can ask the JavaBeautifier to insert carriage
returns after curly braces.
If the -braces=EndOfLine option is supplied,
then code of the following form:
would be transformed into the following:
If the -braces=EndOfLine option is supplied,
then code of the following form:
would be transformed into the following:
|