Skip to content

our general purpose formatter that was pulled together from different projects

Notifications You must be signed in to change notification settings

mohemian/format

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 

Repository files navigation

THIS PROJECT IS NO LONGER MAINTAINED OR SUPPORTED

format

The goal of this project is to combine the formatting capabilities of various projects in the open source community into one easy-to-use command-line feature. The Eclipse IDE and The Groovy-Eclipse plugin provide effective java and groovy source code formatters respectively, so it was decided to extract those classes and add them to this project. However, this project has the potential to format an unlimited number of languages. Below are directions on how to setup and use this formatter, but also included is information on how to add more formatters to this project. Feel free to download this repository and add formatters of your own. In addition, there are instructions on how to add your own preferences to the java and groovy formatters incase you prefer different standards.

Disclaimer

This formatter has been tested on over 1000 groovy and java files. In addition, the groovy formatter has been modified so that it would cancel any formatting of source code that contained unrecognizable syntax. That being said, all software associated with this program is covered under the Apache and Eclipse Public licenses.

Installation of Software

Perform/Ensure the Following:

  1. Only a bash script has been made for this program, so if you work on a windows OS, you will need to install a bash terminal (git, cygwin, etc.).

  2. You will need a recent version of the Java runtime environment (as well as a complete JDK if you plan to modify the source code).

  3. Download this repository (you can download or clone the repo by clicking the button to the right of this page).

  4. Add the absolute path of the bin directory to your path.

  5. To make sure it was correctly installed, enter the following command in your bash shell:

	format -h

If the output is the usage of the formatter, then the software was correctly installed.

How to Use

This program works like most standard command-line formatters. To display the options, enter the same command entered in step 5 of "Installation of Software":

   format -h

As you can see, there are four options provided with the formatter: "-h" (the last command you ran), "-b", "-r", and "-g."

  • "-b" will create a backup file for the file that was ran on. However, if no changes were made to the source code after formatting took place, then a backup will not be created.
  • "-r" will format all files in the directory and subdirectories of the directory that was ran on.
  • "-g" will format all files modified in your current working directory on github.

For example, running the following command in your bash shell will format all files and provide backup files in the directory and subdirectories of the directory that was specified.

	format -r -b <path/to/directory>

Other format information

External Links

About

our general purpose formatter that was pulled together from different projects

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 58.1%
  • Shell 41.8%
  • Groovy 0.1%