Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyproto/javafmt
Organize imports and format code, for Java and Kotlin
https://github.com/xyproto/javafmt
formatter google-java-format java kotlin ktlint organize-imports-cli
Last synced: about 1 month ago
JSON representation
Organize imports and format code, for Java and Kotlin
- Host: GitHub
- URL: https://github.com/xyproto/javafmt
- Owner: xyproto
- License: bsd-3-clause
- Created: 2023-08-15T10:43:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-16T09:48:49.000Z (over 1 year ago)
- Last Synced: 2024-10-05T15:28:48.631Z (about 2 months ago)
- Topics: formatter, google-java-format, java, kotlin, ktlint, organize-imports-cli
- Language: Go
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# javafmt
For both Java and Kotlin, **automatically add or remove imports** and then format the code with `google-java-format` or `ktlint`, depending on the file extension.
## Requirements
* `google-java-format`
* `ktlint`## Example use
```
cd my-java-project
javafmt
```Or to change the files (`-w` for "write"):
```
cd my-java-project
javafmt -w
```Or to format all `.kt` and `.java` in a directory, but not touch the imports:
```
cd my-java-project
javafm -n -w
```## Quick installation
Requires Go 1.21 or later:
go install github.com/xyproto/javafmt@latest
## Issues
This utility is a bit experimental, so the correct imports may not always be used. Bug reports and pull requests are welcome!
## General info
* Version: 1.0.0
* License: BSD-3
* Author: Alexander F. Rødseth <[email protected]>