Skip to content

CLI .gitignore generator

Notifications You must be signed in to change notification settings

hjnowakowski/jignore

Repository files navigation

jignore: CLI for generating .gitignore files

Twitter: hjnowakowski

Disclaimer

The main purpose of this project is to test the GraalVM's native-image tool with a sample CLI Java program. The CLI program (gitignore generator) can be also used on it's own. Some functionality might be missing, but it's planned to be added in some future (see the Issues section for missing functions).

Description

jignore is a CLI app that can generate .gitignore contents. jignore is written in Java and can be compiled to the native image (thanks to GraalVM).

Example usage

jg java kotlin intellij

The above snipped will create a .gitignore (or append to existing) with the ignore contents related to java, kotlin and intellij keywords. Note that firstly you need to compile the app to the native image (see below sections on how to do that) and later add it to the PATH.

The app uses the .gitignore collection from gitignore.io

Performance comparison

The left Terminal shows the execution of the native image. The right one uses jar program. The difference is not huge, however still clearly visible. Note that native image does not require JVM to run.

Prerequisites

  • GraalVM Component Updater v2.0.0 (used to install native-image)
  • GraalVM native-image building tool

Install GraalVM tools

I've used brew to download the GraalVM

brew install --cask graalvm/tap/graalvm-ce-lts-java11

gu install native-image # Install the native-image tool that is used to generate an executable

Build and run the app as a native image

./gradlew build-native-image

Author

👤 Henryk Nowakowski