Skip to content

A modern Java 21 CLI with a beautiful terminal UI: colors, progress bars, tables, spinners, and fluent logging — fast to demo, easy to extend.

License

Notifications You must be signed in to change notification settings

senanqulamov/JavaDays

Repository files navigation

JVD CLI — Java Days 2025

CI Java Gradle License

A modern, extensible Java CLI showcasing algorithms, utilities, and a rich terminal printing toolkit (colors, progress bars, tables, spinners). Built with Java 21 and Gradle. Perfect for demos, interviews, and as a base for premium CLI tooling.


Table of Contents


Features

  • Fast, friendly CLI with discoverable help topics
  • Math utilities: sum, average, min, max
  • Array utilities: sort, reverse, unique
  • Generators: random arrays, maps, matrices
  • Rich terminal printing helpers:
    • Colors, titles, sections, separators
    • Multi-line boxes, spinners, progress bars, ASCII tables
    • Fluent logging builder with levels (INFO, WARN, SUCCESS, ERROR, DEBUG, TRACE)
    • Configurable colors and timestamp format
  • Clean, testable command registry pattern (easy to add new commands)

Quick Start

Requirements:

  • Java 21+
  • Git

Clone and build (Windows cmd):

git clone https://github.com/senanqulamov/JavaDays.git
cd JavaDays
.\gradlew.bat build

Run from Gradle (Windows cmd):

.\gradlew.bat run

Run the packaged JAR:

java -jar build\libs\JavaDays-1.0.0.jar

Note: ANSI colors are supported on most modern terminals. On older Windows shells, enable "Virtual Terminal Processing" or use Windows Terminal/PowerShell.


Run It

When you start the app you’ll see a short progress bar, a title, and a welcome box. At the prompt, type commands and press Enter.

Example session:

jvd> help
jvd> generate array 5
jvd> sum 1 2 3 4 5
jvd> array sort 5 2 8 1 9
jvd> generate matrix 3 4
jvd> exit

Usage

Core global commands:

  • help or h — Show help and topics
  • version or v — Show application version
  • exit or quit — Quit the CLI

Help topics:

  • help sum
  • help generate
  • help array
  • help map

Generators:

  • generate sum [count] — Generate random array and print sum
  • generate array [count] — Generate a random array
  • generate map [size] — Generate random key/value pairs
  • generate matrix [rows] [cols] — Generate a 2D matrix

Math:

  • sum <numbers...>
  • avg <numbers...>
  • max <numbers...>
  • min <numbers...>

Array ops:

  • array sort <numbers...>
  • array reverse <numbers...>
  • array unique <numbers...>

Defaults and limits:

  • Default generated size: 10
  • Max array/map size: 100,000
  • Random values range: 0–99

Command Reference

Quick reference for all built-ins (abbreviations included):

Command Description
help, h Show general help
help sum Help for sum operations
help generate Help for generate commands
help array Help for array operations
help map Help for map generation
version, v Show version
exit, quit Exit application
generate sum [count] Generate array and print sum
generate array [count] Generate and display array
generate map [size] Generate random map
generate matrix [rows] [cols] Generate a 2D matrix
sum <n...> Sum numbers
avg <n...> Average of numbers
max <n...> Maximum value
min <n...> Minimum value
array sort <n...> Sort ascending
array reverse <n...> Reverse input
array unique <n...> Unique elements

PrintHelpers (UI/UX Toolkit)

The jvd.Helpers.PrintHelpers module powers formatted output. Highlights:

  • Fluent logging API:

    import static jvd.Helpers.PrintHelpers.*;
    
    log().level(LogLevel.WARNING).message("Low disk space").print();
    log().level(LogLevel.INFO).format("User %s logged in", username).print();
    log().level(LogLevel.SUCCESS).message("Done").sameLine().print();
  • Colors, titles, sections, separators:

    printTitle("JVD CLI");
    printSection("Math utilities");
    printSeparator();
  • Boxes, progress, spinners, tables:

    printBox(
        "Welcome to the optimized PrintHelpers!",
        "",
        "Key improvements:",
        "• Fluent Builder API",
        "• Progress bars and tables",
        "• Better performance with StringBuilder",
        "• Configurable colors and timestamps"
    );
    
    for (int i = 0; i <= 100; i++) { printProgressBar(i, 100); Thread.sleep(15); }
    printSpinner("Executing", 1000);
    
    String[] headers = {"Name", "Age", "Role"};
    String[][] rows = {{"John","28","Dev"},{"Sarah","32","Manager"}};
    printTable(headers, rows);
  • Debug and formatting helpers:

    printDebug(() -> expensiveDebugMessage());
    printFormattedInfo("Items: %d", items.size());

Configuration

You can tweak behavior at runtime:

// Toggle debug logs
setDebugMode(true);   // or disableDebug(); enableDebug();

// Customize timestamp format
setTimestampFormat(java.time.format.DateTimeFormatter.ofPattern("HH:mm:ss"));

// Customize log level colors
setLevelColor(LogLevel.WARNING, jvd.Helpers.Colors.AnsiColor.CYAN);

Architecture

  • jvd.Main — entry point. Initializes UI, starts REPL loop.
  • Functions.Commands — command registry and handlers. Declarative registerCommand mapping to handler methods; robust arg parsing helpers.
  • jvd.Helpers.PrintHelpers — rich terminal output utilities (colors, boxes, progress, tables, spinner, builder-style logging).
  • jvd.Helpers.Colors — ANSI color definitions.

Why this approach:

  • Simple to extend: add a handler and one registration line.
  • Testable: pure handlers operating on a context with parsed args.
  • UX-first: consistent, colorful output aids demos and interviews.

Extending with New Commands

Add a command in Functions/Commands.java:

// 1) Register it (in the static initializer)
registerCommand("greet", Commands::handleGreet, "Say hello");

// 2) Implement the handler
private static void handleGreet(CommandContext ctx) {
    printSuccess("Hello from JVD!");
}

The context helpers make parsing easy:

int count = ctx.getIntArg(0, 10);  // first arg or default
int[] numbers = ctx.getIntArrayArgs(); // parse all as ints

Packaging & Distribution

Standard Gradle build creates:

  • Executable JAR: build/libs/JavaDays-1.0.0.jar
  • Distributions (zip/tar) with launch scripts: build/distributions/JavaDays-1.0.0.zip
    • Windows launcher inside the unzipped folder: bin/JavaDays.bat

Build:

.\gradlew.bat clean build

Run distribution (after unzip the archive into a folder):

.\bin\JavaDays.bat

Tech Stack

  • Language: Java 21
  • Build: Gradle (Application plugin)
  • Runtime: Console/Terminal (ANSI colors)
  • Dependencies: Standard JDK (no external runtime deps)

Why It Stands Out

  • Clear architecture: separation of concerns between UI helpers and command logic
  • Extensibility: new commands added with one registration and one handler
  • Developer experience: rich formatted output for readable demos
  • Performance-minded: StringBuilder usage, lazy debug evaluation, minimal allocations
  • Production-ready patterns: configuration knobs, color theming, consistent logging format

Screenshots


Releases

Cutting a release publishes build artifacts (JAR + zipped distributions) automatically via GitHub Actions.

Steps:

  • Update version in build.gradle if needed
  • Commit your changes
  • Tag with a semantic version and push the tag:
git tag v1.0.0
git push origin v1.0.0

The workflow .github/workflows/release.yml will build and attach:

  • build/libs/*.jar
  • build/distributions/*.zip and .tar

Find releases here: https://github.com/senanqulamov/JavaDays/releases


Roadmap

  • Command history and better input editing
  • Config file (YAML/JSON) for defaults and theming
  • File/JSON logging modes and log rotation
  • Unit tests for command handlers and helpers
  • More algorithms (searching, sorting variants, stats)
  • Plugin system for user-defined commands

Pro / Premium Edition

A premium version will include:

  • Extended logging (file, JSON, structured events)
  • Rich themes, light/dark palettes, and branding
  • Scripting mode and batch command files
  • Performance metrics, benchmarks, and profiling helpers
  • Auto-complete, suggestions, and fuzzy matching
  • Signed installers and enterprise packaging

Interested in a commercial license or custom features? Reach out to me to discuss a Pro build tailored to your needs.


Contributing

Issues and PRs are welcome. If you’d like ideas, check the Roadmap. Keep code clean, cohesive and documented. Small, focused PRs are preferred.

See the full guide: CONTRIBUTING.md


License

MIT © 2025 Senan Qulamov — See LICENSE for details.


Changelog

Track notable changes in CHANGELOG.md. The release workflow is tag-driven (see Releases).

About

A modern Java 21 CLI with a beautiful terminal UI: colors, progress bars, tables, spinners, and fluent logging — fast to demo, easy to extend.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages