Giter Site home page Giter Site logo

dmkyr20 / tables4j Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 2.0 683 KB

Java-Cli-Table-Builder makes it easy to create flexible command-line tables. You haven't need to write your classes and methods to decorate console output anymore. Just use this flexible tool for positioning.

License: MIT License

Java 100.00%
java java-8 cli builder maven repository easy-to-use command-line command-line-tool library java-11 java-library console console-application console-log console-app console-tool

tables4j's Introduction

Java-Cli-Table-Builder

Thank you for choosing Java-Cli-Table-Builder - an easy to use command-line interface tool.

GitHub license GitHub release

Overview

Java-Cli-Table-Builder makes it easy to create flexible command-line tables. You haven't need to write your classes and methods to decorate console output anymore. Just use this flexible tool for positioning.

Examples

Example 1

Creating simple CLI game interface.
You haven't need make formatting output by yourself anymore. Use already created methods for creating independent blocks on screen.

Code
public void simpleOutput() throws CellContentException {
    TableBuilder tableBuilder = new TableBuilder();
    tableBuilder.setDefaultCellBorderStyle(CellBorderTemplate.SOLID.getBorderStyle());

    tableBuilder.addCell(HEADER, new CellPosition(0, 0, 100, 12));
    tableBuilder.addCell("1 - Start", new CellPosition(0, 12, 25, 15));
    tableBuilder.addCell("2 - Load", new CellPosition(25, 12, 50, 15));
    tableBuilder.addCell("5 - Settings", new CellPosition(50, 12, 75, 15));
    tableBuilder.addCell("6 - Exit", new CellPosition(75, 12, 100, 15));

    tableBuilder.print();
}
Output
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                  │
│                                                                                                  │
│                                                                                                  │
│                             █▀▀ █░░ ░▀░         █▀▀▀ █▀▀█ █▀▄▀█ █▀▀                              │
│                             █░░ █░░ ▀█▀         █░▀█ █▄▄█ █░▀░█ █▀▀                              │
│                             ▀▀▀ ▀▀▀ ▀▀▀         ▀▀▀▀ ▀░░▀ ▀░░░▀ ▀▀▀                              │
│                                                                                                  │
│                                                                                                  │
│                                                                                                  │
│                                                                                                  │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌───────────────────────┐┌───────────────────────┐┌───────────────────────┐┌───────────────────────┐
│       1 - Start       ││       2 - Load        ││     5 - Settings      ││       6 - Exit        │
└───────────────────────┘└───────────────────────┘└───────────────────────┘└───────────────────────┘

Example 2

Easy and fast changes in any completed output.
You can add a block of content in any place on screen. You shouldn't care about previously created content anymore.

Code
public void simpleOutputWithNote() throws CellContentException {
    TableBuilder tableBuilder = new TableBuilder();
    tableBuilder.setDefaultCellBorderStyle(CellBorderTemplate.SOLID.getBorderStyle());

    tableBuilder.addCell(HEADER, new CellPosition(0, 0, 100, 12));
    tableBuilder.addCell("1 - Start", new CellPosition(0, 12, 25, 15));
    tableBuilder.addCell("2 - Load", new CellPosition(25, 12, 50, 15));
    tableBuilder.addCell("5 - Settings", new CellPosition(50, 12, 75, 15));
    tableBuilder.addCell("6 - Exit", new CellPosition(75, 12, 100, 15));

    Cell note = new Cell(new CellPosition(1, 8, 90, 11), NOTE);
    note.setCellBorderStyle(CellBorderTemplate.NO_BORDERS.getBorderStyle());
    note.setHorizontalAlignment(CellHorizontalAlignment.LEFT);
    tableBuilder.addCell(note);

    tableBuilder.print();
}
Output
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                  │
│                                                                                                  │
│                                                                                                  │
│                             █▀▀ █░░ ░▀░         █▀▀▀ █▀▀█ █▀▄▀█ █▀▀                              │
│                             █░░ █░░ ▀█▀         █░▀█ █▄▄█ █░▀░█ █▀▀                              │
│                             ▀▀▀ ▀▀▀ ▀▀▀         ▀▀▀▀ ▀░░▀ ▀░░░▀ ▀▀▀                              │
│                                                                                                  │
│                                                                                                  │
│ Note: Pres number key to choose.                                                                 │
│                                                                                                  │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌───────────────────────┐┌───────────────────────┐┌───────────────────────┐┌───────────────────────┐
│       1 - Start       ││       2 - Load        ││     5 - Settings      ││       6 - Exit        │
└───────────────────────┘└───────────────────────┘└───────────────────────┘└───────────────────────┘

Requirements

  • Java 8 JDK or later.

How to start?

You can use the library as .jar file. Or run it using the CLI as executable .jar file.
Copy the project. Then go to a folder with project and run gradle gradle clean build command. Ready to use .jar file located in target folder.

Or include it using maven or gradle:

Maven

<dependency>
  <groupId>org.dmkyr20.Java-Cli-Table-Builder</groupId>
  <artifactId>java-cli-table-builder</artifactId>
  <version>1.0.2</version>
</dependency> 

Gradle

implement 'org.dmkyr20.Java-Cli-Table-Builder.java-cli-table-builder:1.0.2'

See Package.

Documentation

You could find all documentation for project in JavaDoc.
Or in Documentation. (Not Allowed yet)

License

Distributed under the MIT License. See LICENSE for more information.

tables4j's People

Contributors

dependabot[bot] avatar dmkyr20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tables4j's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.