Skip to content

Instantly share code, notes, and snippets.

@Panthro
Last active March 2, 2021 14:56
Show Gist options
  • Save Panthro/a7dbcc44fb21532e178ca4c4bb010c7b to your computer and use it in GitHub Desktop.
Save Panthro/a7dbcc44fb21532e178ca4c4bb010c7b to your computer and use it in GitHub Desktop.
Ktlint format that uses maven or gradle
  • Add this to your ~/.bash_profile or ~/.zshrc.
  • Then regardles if the project is setup with maven or gradle when you execute kf the right task is going to be executed
function kf {
if [ -f pom.xml ]; then
echo "Using maven antrun"
./mvnw antrun:run@ktlint-format
else
echo "Using gradle"
./gradlew ktlintFormat
fi
}
@gerardbosch
Copy link

gerardbosch commented Mar 2, 2021

Thank you @Panthro !! Now part of my dotfiles :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment