freva / ascii-table Goto Github PK
View Code? Open in Web Editor NEWASCII Tables for Java
License: MIT License
ASCII Tables for Java
License: MIT License
This is my table format
id column1 column2 column3
---- --------------- ------------------------------ ------------------
1 data11 data12 data13
2 data21 data22 data23
3 data31 data32 data33
4 data41 data42 data43
I need to have empty line between each record to view the data clearly.
Hi
Couldn't create a table from Collection, because the ColumnData constructor is package private.
So I could use that constructor from AsciiTable.
Wrongly placed comma in group-id
You may want to always have a column that has a minimum length.
It works well for most of my requirements.
Is it possible to implement span columns using this library?
Hi, I hope it's ok to ask this here. I am using AsciiTable to create an email body and it seems to work fine on thunderbird, but its a bit broken on windows outlook.
i get this nice table in thunderbird:
this is what it displays on outlook
does anyone know anything i can do to get this working on outlook better? or any suggestions will be appreciated
Hi
Many thanks for this great table printer.
Just in case you want to see what we have been up to of late with Apache Camel, then we have a panel in the middle with 2 columns. When using ansi color then the 2nd panel will start out of position.
I think you have been aware of this and its tricky to solve. But just wanted to show you a real world use of this great util.
Great utility, we started using this with Apache Camel
We print a table with Camel route status, and instead of word wrapping then I would like to make it automatic cut the excess length
new Column().header("Name").dataAlign(HorizontalAlign.LEFT).maxColumnWidth(30).with(r -> r.name),
new Column().header("Route ID").dataAlign(HorizontalAlign.LEFT).maxColumnWidth(30).with(r -> r.routeId),
new Column().header("From").dataAlign(HorizontalAlign.LEFT).maxColumnWidth(30).with(r -> r.from),
See screenshot for an example of what it does today with word wrap.
At Apache Camel we have a new for a master/child row that is something ala
Column A | Column B | Column C | Column D
Column E that spans the entire line
Column A | Column B | Column C | Column D
Column E that spans the entire line
Column A | Column B | Column C | Column D
Column E that spans the entire line
I only need one special column. Maybe something you can add as the last column in a table, and specify that is a child column or something.
Can we have an option to set a preferred line separator instead of System.lineSeparator()
?
I would like to be able to cut the column value in the start, so the visible text is the suffix text, eg
I have this class name sample.camel.MyCamelApplication
which are shown in full in the PS command below
~/workspace ❯ camel ps
PID NAME AGE
61818 sample.camel.MyCamelApplication 5s
However in the next command with more details I want to cut the class name in the beginning, eg:
~/workspace ❯ camel get
PID NAME CAMEL PLATFORM READY STATE AGE TOTAL FAILED INFLIGHT SINCE-LAST
61818 sample.camel.MyCamelApplica… 3.19.0-SNAPSHOT Spring Boot v2.7.3 1/1 Started 9s 3 0 0 0s
Should be `....camel.MyCamelApplication`
PS: Thanks for implementing the other features so quickly, we use this table library with joy at Apache Camel for our new CLI.
I'm using this extension to produce output that is a hyperlink https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda.
When using a hyperlink as a value then the width of it isn't calculated correctly.
As an example consider the following value
\u001B]8;;http://example.com\u001B\\This is a link\u001B]8;;\u001B\\\n
I'd expect the value to be displayed in the column to be only This is a link
but I think it's calculating the width on all characters
I am experimenting with adding colour output via
https://github.com/fusesource/jansi
This is what for example Apache Maven, Spring Boot, etc uses to log in colour.
I wanted to mark Camel components that are in preview mode with a yellow colour, that are in a middle column. When doing this then the column width gets larger ... I just wanted to let you know and we can maybe work on having better color support over time.
See the screenshot below
This causes e.g. a b \nc d
to have a col width of 8 instead of the expected 3
It would be flexible if you provide a utility method that simply returns collection of rows in the table.
To say exactly the result of below method.
private static List<String> getTableRows(int[] colWidths, HorizontalAlign[] headerAligns, HorizontalAlign[] dataAligns, HorizontalAlign[] footerAligns, Character[] borderChars, String[] header, String[][] data, String[] footer) {
At Apache Camel we have a CLI that allows to output data in tables, and we want to allow the table to output only specific columns depending on CLI arguments. (for example a --wide mode to list more etc.)
However it is a bit too difficult to make it possible to define the table once with all the columns, alignment, min/max width etc, and then afterwards be able to select which columns to include when printing the table.
So what we have done is to copy the table and have "ugly" if ... elseif ... code in Camel.
Here is a little example whether GAV is enabled or not
https://github.com/apache/camel/blob/main/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogBaseCommand.java#L77
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.