GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mintUI9976/ConsoleLine: A simple console input/ output library based on Jline

BranchesTags
Open more actions menu

Latest commit

 

History

40 Commits
40 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
gradle/wrapper
gradle/wrapper
 
 
src/main/java/de/mint/consoleline
src/main/java/de/mint/consoleline
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 
terminal.svg
terminal.svg
 
 

Repository files navigation


A simple console input/ output library based on Jline




Jline3   •   CompactMap   •   Reflections

About ConsoleLine

Usage:

  • usable with jdk 17 and above
  • usable via Jvm hotspot and java9

Features:

  • command system

    • references to CommandArguments
    • no command register, it will be registered by Reflection
  • custom exception

    • references to RuntimeException
  • log system

    • references to FileWriter
    • can be activated or deactivated
    • log path
    • log filename
  • event system

    • input
      • thread able - by set thread size
      • period - set as long
      • messages will be written into log file
    • output
      • output stream will be written into log file
    • error
      • error stream will be written into log file
  • builder system

    • terminal can be created by builder principle
  • string color system

    • native Jline3 AttributedStringBuilder , AttributedStyle integration

Utilization:

CreateTerminal - Example:

public class Test {

    public static void main(final String[] args) {
        final JlineExecutor jlineExecutor =
                JlineBuilder.getJlineBuilder()
                        .setThreadSize(3)
                        .setPrompt(Test.prompt())
                        .setCommandArgumentNotAvailable("The arguments are not available")
                        .setCommandNotAvailable("The command is not available")
                        .setPrefix("de.mint.consoleline")
                        .setLog(true)
                        .build();
        jlineExecutor.buildTerminal();
    }

    private static String prompt() {
        return new AttributedStringBuilder()
                .style(AttributedStyle.DEFAULT.foreground(AttributedStyle.CYAN))
                .append("@prompt")
                .style(AttributedStyle.DEFAULT)
                .append("> ")
                .toAnsi();
    }
}

CreateTerminal - LogSystem:

public static void main(final String[]args){
final JlineExecutor jlineExecutor=
        JlineBuilder.getJlineBuilder()
        .setThreadSize(3)
        .setPrompt("@prompt> ")
        .setCommandArgumentNotAvailable("The arguments are not available")
        .setCommandNotAvailable("The command is not available")
        .setPrefix("de.mint.consoleline")
        .setLog(true)
        .setLogFilename("Sample.txt")
        .setLogPath("sample/")
        .build();
        jlineExecutor.buildTerminal();
        }

CreateCommand - Example:

public class TestCommand implements CommandArguments {

    public TestCommand() {
    }

    @Override
    public @NotNull String commandName() {
        return "test";
    }

    @Override
    public void onCommand(final String[] arguments) {
        switch (arguments[0]) {
            case "print":
                if (arguments.length > 1) {
                    final String[] message = Arrays.copyOfRange(arguments, 1, arguments.length);
                    System.out.println("TestCommand: " + String.join(" ", message));
                } else {
                    System.out.println("Test output");
                }
        }
    }
}

About

A simple console input/ output library based on Jline

Topics

cmdcolorcommandcommand-systemconsoleerrorinputinput-outputjavalinelogloggeroutputprintstreamprompt

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.