A CLI tool built with Micronaut and Picocli for efficient system maintenance and automation, leveraging GraalVM native image for optimal performance.
- Prerequisites
- Setup
- Building the Project
- Running the Application
- Native Image Compilation
- Making the CLI Globally Available
- References
- Java 17 (GraalVM 17) installed via SDKMAN
sdk install java 17.0.12-graal sdk use java 17.0.12-graal
- Native Image tool installed:
To verify installation:
gu install native-image
You should see output resembling:gu list
ComponentId Version Component name Stability Origin ----------------------------------------------------------------------------------------------- graalvm 23.0.5 GraalVM Core Supported native-image 23.0.5 Native Image Early adopter
Note: Native Image is supported only by OpenJDKs (JDK 8 to JDK 17).
Clone this repository and navigate to its root directory.
Use the Gradle Wrapper to clean and build the project:
./gradlew clean buildUsing the Gradle Daemon will speed up builds (similar to JVM for Java).
Refer to the Gradle Daemon Documentation for setup and details.
To build the project with the Gradle Daemon:
./gradlew --daemon assembleAfter building, you can run the CLI application using:
java -jar build/libs/rmtrix-0.1-all.jar Search -s ollamaUse Ctrl+C to terminate the current operation.
Build a native executable using the following command:
native-image -cp build/libs/rmtrix-0.1-all.jar --initialize-at-run-time=ch.qos.logback,org.slf4j,io.netty --no-fallback com.github.meettak.RmtrixCommand rmtrixTo find where the binary was created:
find . -name rmtrix -type f -executableTypically, it may be found in:
build/native/nativeCompile/rmtrix -s ollama- Ensure the file is executable:
chmod +x rmtrix
- Move the executable to a directory in your
PATH:sudo mv rmtrix /usr/local/bin/
- Now you can run the CLI from anywhere:
rmtrix Search -s <filename>
Special thanks to the stackoverflow-cli project, which inspired and supported aspects of this CLI's development.