Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-1281

New table support for shell

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • karaf
    • None

    Description

      I have implemented a new table implementation that is very easy to use. I would like to replace the current table impl with it but would like some feedback first.

      The usage of the table can be seen from the ShellTableTest:

      ShellTable table = new ShellTable();
      table.column(new Col("id").alignRight().maxSize(5));
      table.column(new Col("Name").maxSize(20));
      table.column(new Col("Centered").alignCenter());

      table.addRow().addContent(1, "Test", "Description");
      table.addRow().addContent(20, "My name", "Description");

      Row row = table.addRow();
      row.addContent(123456789);
      row.addContent("A very long text that should be cut");
      row.addContent("A very long text that should not be cut");

      table.print(System.out);


      The output looks like this:

       
      |    id | Name                 |                Centered                 |
      --------------------------------------------------------------------------
      |     1 | Test                 |               Description               |
      |    20 | My name              |               Description               |
      | 12345 | A very long text tha | A very long text that should not be cut |
      

      Attachments

        Activity

          People

            cschneider Christian Schneider
            cschneider Christian Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: