Git Product home page Git Product logo

picnic's Issues

Feature request: render an empty footer

Imagine this table

        table {
          style {
            borderStyle = Solid
          }
          cellStyle {
            borderLeft = true
            borderRight = true
          }
          header {
            cellStyle {
              border = true
              alignment = BottomLeft
            }
            row("Header 1", "Header 2")
          }
          body {
            repeat(3) {
              row("row $it", "row $it")
            }
          }
        }

It would render:

┌────────┬────────┐
│Header 1│Header 2│
├────────┼────────┤
│row 0   │row 0   │
│row 1   │row 1   │
│row 2   │row 2   │

Notice that the border at the bottom is missing. The fix is could be to render a different row in the body

            row {
              cell("last row") {
                borderBottom = true
              }
              cell("last row") {
                borderBottom = true
              }
            }

Or another fix could be to render a footer:

          footer {
            cellStyle {
              borderBottom = true
            }
            row("Footer 1", "Footer 2")
          }

But this is annoying, because the last row is a special case. I'd rather would like to specify a footer like this:

          footer {
            cellStyle {
              border = true
            }
          }

But this doesn't render anything since there is no row.

Legacy mode

When using picnic 0.6.0 I'm getting:

The dependency com.jakewharton.picnic:picnic:0.6.0 was published in the legacy mode. Support for such dependencies will be removed in the future. See https://kotl.in/0b5kn8 for details.

Seems like tooling needs to be udpated, a new release needs to be cut and then we're all good.

Characters don't work on Windows

It appears that the unicode characters are not generated or recognized correctly on Windows.

I've opened a PR to add a GitHub action to build on Windows, Linux and Mac; the Windows build always fails, though, because the tables look like this:

    ?          compressed           ?          uncompressed          
        ?????????????????????????????????????????????????????????????????
APK      ? old       ? new       ? diff  ? old       ? new       ? diff   
???????????????????????????????????????????????????????????????????????????
    dex ? 664.8 KiB ? 664.8 KiB ? -25 B ?   1.5 MiB ?   1.5 MiB ? -112 B 
    arsc ? 201.7 KiB ? 201.7 KiB ?   0 B ? 201.6 KiB ? 201.6 KiB ?    0 B 
manifest ?   1.4 KiB ?   1.4 KiB ?   0 B ?   4.2 KiB ?   4.2 KiB ?    0 B 
    res ? 418.2 KiB ? 418.2 KiB ? -14 B ? 488.3 KiB ? 488.3 KiB ?    0 B 
    asset ?       0 B ?       0 B ?   0 B ?       0 B ?       0 B ?    0 B 
    other ?  37.1 KiB ?  37.1 KiB ?   0 B ?  36.3 KiB ?  36.3 KiB ?    0 B 
???????????????????????????????????????????????????????????????????????????

See build results here.

Columns are messed up with ANSI color codes

Expected behavior

Tables to be correctly drawn with ANSI color codes

Current behavior

Tables are messed up with Chinese ANSI color codes


Version: 0.4.0
OS: MacOS BigSur - english language
IDE: IntelliJ Idea Ultimate 2020.2
Kotlin: 1.4.0
Project type: Multiplatform, JVM variant only for this module ( stdlib-jdk8 )
JDK: 14

image
image

TEXT EXAMPLE

"\u001B[46mWelcome to My App!\u001B[0m"

TEXT RESULT

┌───────────────────────────────────────────────────────────────────┐
│                                                                   │
│                    Welcome to My App!                    │
│                                                                   │
├──────────────────────────────────┬────────────────────────────────┤
│                                  │            commands            │
├──────────────────────────────────┼───────┬────────────────┬───────┤
│   Search a Movie by title        │   1   │   search       │   s   │
├──────────────────────────────────┼───────┼────────────────┼───────┤
│   Rate a Movie by id             │   2   │   rate         │   r   │
├──────────────────────────────────┼───────┼────────────────┼───────┤
│   Get suggested Movies for you   │   3   │   suggestion   │   g   │
└──────────────────────────────────┴───────┴────────────────┴───────┘

Support for table with external borders but no inner borders for top/bottom

Picnic could be able to do build

┌───────────┬──────────────┐
│ columnA   │ columnB      │
├───────────┼──────────────┤
│ itemA1    │ B            │
│ itemA2    │ C            │
│ itemA3    │ D            │
└───────────┴──────────────┘

But right now I can only build

┌───────────┬──────────────┐
│ columnA   │ columnB      │
├───────────┼──────────────┤
│ itemA1    │ B            │
│ itemA2    │ C            │
│ itemA3    │ D            │

Using header (border=true) + body(borderLeft=true, borderRight=true)

Support hyperlinks

I'm using picnic to print out tables for a command line tool. On some tables, I'd like to have hyperlink support. Do you have any ideas / suggestion how to have them clickable by iTerm?

iTerms and other consoles have support for links:

printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'

Source

Columns are messed up with unicode chars

Expected behavior

Tables to be correctly drawn with unicode characters

Current behavior

Tables are messed up with unicode characters


Version: 0.4.0
OS: MacOS BigSur - english language
IDE: IntelliJ Idea Ultimate 2020.2
Kotlin: 1.4.0
Project type: Multiplatform, JVM variant only for this module ( stdlib-jdk8 )
JDK: 14

Chinese chars

image

TEXT:

┌──────────────────────────────────────────────────────────────────────────────────┬─────────────┬───────────────────┐
│  呀〈KIBA〉 ~暗黒騎士鎧伝~                                                                │  Year 2011  │  Tmdb id: 257171  │
├──────────────────────────────────────────────────────────────────────────────────┴─────────────┴───────────────────┤
│  Actors: Masaki Kyômoto, Mika Hijii, Leah Dizon, Mikoto Inoue, Raima Hiramatsu, Kazuhiko Inoue, Miz...             │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  Genres: Fantasy, Action, Adventure                                                                                │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

ANSI color code

image
image

TEXT EXAMPLE

"\u001B[46mWelcome to My App!\u001B[0m"

TEXT RESULT

┌───────────────────────────────────────────────────────────────────┐
│                                                                   │
│                    Welcome to My App!                    │
│                                                                   │
├──────────────────────────────────┬────────────────────────────────┤
│                                  │            commands            │
├──────────────────────────────────┼───────┬────────────────┬───────┤
│   Search a Movie by title        │   1   │   search       │   s   │
├──────────────────────────────────┼───────┼────────────────┼───────┤
│   Rate a Movie by id             │   2   │   rate         │   r   │
├──────────────────────────────────┼───────┼────────────────┼───────┤
│   Get suggested Movies for you   │   3   │   suggestion   │   g   │
└──────────────────────────────────┴───────┴────────────────┴───────┘

calling `renderText` from Java

Hi, thanks for this useful library! I'm using it in a Java project and I wanted to try out the ROUNDED and ASCII styles, but I cannot seem to access Table.renderText (or Table.render). Is this feature meant to be available from Java?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/build.yaml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/actions v3
  • ffurrer2/extract-release-notes v2
  • softprops/action-gh-release v2
gradle
gradle.properties
settings.gradle
build.gradle
  • org.jetbrains.kotlin:kotlin-gradle-plugin 2.0.0
  • org.jetbrains.dokka:dokka-gradle-plugin 1.9.20
  • com.diffplug.spotless:spotless-plugin-gradle 6.25.0
  • ru.vyarus:gradle-animalsniffer-plugin 1.7.1
  • com.vanniktech:gradle-maven-publish-plugin 0.29.0
  • org.codehaus.mojo.signature:java18 1.0
  • net.sf.androidscents.signature:android-api-level-21 5.0.1_r2
picnic/gradle.properties
picnic/build.gradle
  • com.jakewharton.crossword:crossword 0.3.0
sample/build.gradle
  • com.github.ajalt:mordant 1.2.1
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.8

  • Check this box to trigger a request for Renovate to run again on this repository

Markdown links break the table

I have a picnic table where I am trying to render links using markdown (through mordant 2.0 markdown support). The cell breaks the table though because the width is calculated with the entire string and not just the visible part. Is there any way to work this around?

Passing a PrintStream to renderText

It would be great if we could pass a PrintStream to the renderText call so that large tables can be streamed out immediately and to reduce the memory footprint.

Notice year wrong?

Might be nitpicking here, but is the copyright year in README.md really 2015?

support horizontal rule

In the tables I'm generating, I have several sections. It would useful to be able to add a separator between these sections.

How to use picnic in Java

I wonder if there is a simple quick start example for the usage of picnic in Java? A minimal introduction to Java usage would be great.

0.3.0 introduced an undocumented dependency on java8 - String.

0.3.0 specifically commit: 2ef687d
introduced a dependency on java8 String

I was using the lib inside an android application (mainly running on android6 devices).
project is setup:

  • with Java source/target compatibility 8
  • kotlin jvm target 8

Project compile without any issue or warning but the app ultimately crash when invoking the codePoints method.

E java.lang.NoSuchMethodError: No virtual method codePoints()Ljava/util/stream/IntStream; in class Ljava/lang/String; or its super classes (declaration of 'java.lang.String' appears in /system/framework/core-libart.jar) E at com.jakewharton.picnic.SimpleLayout.draw(textLayout.kt:62) E at com.jakewharton.picnic.TextRendering.render(textRender.kt:314) E at com.jakewharton.picnic.TextRendering.render$default(textRender.kt:16)

Feature request: CSV (or DSV) rendering

Thank's for the great library. I use it in some of my projects and very happy with results (especially combined with Mosaic).

In one of my projects I've faced with requirement to output data as CSV along with human-readable tables. I've came up with my
own solution (not a rocket science) and got thinking that there could be some CSV related API in Picnic.

  • CSV (or more general DSV) format has no different in meaning from ASCII tables
  • Such new rendering API could benefit from existing Mosaic API (rows, columns, cell, columnSpan)
  • On the other side new API could contradict the single responsibility principle of the library (only ASCII tables)

So my questions are:

  • what do you think about supporting CSV?
  • if it works will you add that API in some future?
  • may I help with this?

Thank you

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.