Skip to content

setRenderer doesn't work #135

Closed
Closed

Description

@joerecra

When I use: $table->setRenderer(new \cli\table\Ascii([80, 20, 20])) or I change array values into Ascii this doesn't work, table doesn't rendered.

$table = new \cli\Table();
$table->setHeaders($headers);
$table->setRows($results);
$table->setRenderer(new \cli\table\Ascii([80, 20, 20]));
$table->display();

Please any help I pleasure it.

captura

Activity

  1. wojsmol commented on Aug 21, 2018

    @wojsmol

    Please post wp --info from your testing environment.

  2. joerecra commented on Aug 21, 2018

    @joerecra
    Author

    Hey @wojsmol thanks for your request this is my wp --info:

    OS: Linux 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64
    Shell: /bin/bash
    PHP binary: /usr/bin/php7.2
    PHP version: 7.2.9-1+ubuntu18.04.1+deb.sury.org+1
    php.ini used: /etc/php/7.2/cli/php.ini
    WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir: phar://wp-cli.phar/vendor
    WP_CLI phar path: /home/joe
    WP-CLI packages dir:
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 2.0.0

  3. schlessera commented on Aug 21, 2018

    @schlessera
    Member

    @joerecra What are you trying to do with this: new \cli\table\Ascii([80, 20, 20])?

    I'm not sure I fully understand what the problem is, but I'm guessing you're misinterpreting what the column widths do.

    [80, 20, 20] will set the widths of the first three columns to 80, 20 and 20 respectively. It will probably produce broken and arbitrary output if you have more columns than you provide the width for.

    So, either let the system just handle it automatically (new \cli\table\Ascii()), or provide as many widths as you have columns.

    Let me know if I just misunderstood your report...

  4. joerecra commented on Aug 21, 2018

    @joerecra
    Author

    Well @schlessera, Whit this: new \cli\table\Ascii([80, 20, 20]) I'm trying to set width columns in my table.

    When I add one column "Empty" and remove setRenderer this automatically renderers, let's call it "good"

    tablegood

    But I want to set width, putting my own widths Maybe 50 or 80 or 100 whatever, I don't Know. But this doesn't work.

    In last image I used: $table->setRenderer(new \cli\table\Ascii([80, 5, 20, 20, 20]));
    but nothing changes. Another thing, in examples dir I change widths and it doesn't work neither.

    I'm confusing. Sorry

  5. added this to the 0.12.0 milestone on Aug 22, 2018
  6. joerecra commented on Aug 22, 2018

    @joerecra
    Author

    Thank you @schlessera bug was corrected !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions