terminus icon indicating copy to clipboard operation
terminus copied to clipboard

Table data should not limit column width

Open irosewfs opened this issue 3 years ago • 1 comments

Platform

(x) MacOS ( ) Linux ( ) Winderz

Installed Via

(x) Homebrew ( ) Apt Package ( ) Manually

PHP Version

(x) 7.4x ( ) 8.0 ( ) 8.1

Command Executed

site:list (or any command resulting in a table output)

Expected behavior

Table columns should be the full width of the data, lines should wrap in the terminal if needed (per the terminal, not per new lines in the command output). An option should allow for limiting the width of the output (--format=limited-width-table or similar).

user@host$ terminus site:list
 -------------------- -------------------------------------- ------------------- ----------- --------------- -------------------------------------- --------------------- --------------------------------------------------------------------------------------------------- ------------ 
  Name                 ID                                     Plan                Framework   Region          Owner                                  Created               Memberships                                                                                         Is Frozen?
 -------------------- -------------------------------------- ------------------- ----------- --------------- -------------------------------------- --------------------- --------------------------------------------------------------------------------------------------- ------------
  nineteencharacters   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   Elite               drupal      United States   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   1970-01-01 00:00:00   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:Team,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:nineteencharacters   false
  nineteencharacters   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   Performance Large   drupal      United States   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   1970-01-01 00:00:00   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:Team,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:nineteencharacters   false
  nineteencharacters   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   Performance Small   drupal      United States   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   1970-01-01 00:00:00   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:Team,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:nineteencharacters   false
 -------------------- -------------------------------------- ------------------- ----------- --------------- -------------------------------------- --------------------- --------------------------------------------------------------------------------------------------- ------------

Actual behavior

Table columns are artificially restricted in width. This is particularly problematic when using a command like site:list where one of the columns is a UUID. It is a pain to try to select/copy the contents of any field.

user@host$ terminus site:list
 ------ -------- ------ ----------- -------- -------- --------- -------------------- ------------
  Name   ID       Plan   Framework   Region   Owner    Created   Memberships          Is Frozen?
 ------ -------- ------ ----------- -------- -------- --------- -------------------- ------------
  nin    xxxxxx   Eli    d           Un       xxxxxx   197       xxxxxxxx-xxxx-xxxx   false
  ete    xx-xxx   te     r           it       xx-xxx   0-0       -xxxx-xxxxxxxxxxxx
  enc    x-xxxx          u           ed       x-xxxx   1-0       :
  har    -xxxx-          p           St       -xxxx-   1         Team,xxxxxxxx-xxxx
  act    xxxxxx          a           at       xxxxxx   00:       -xxxx-xxxx-xxxxxxx
  ers    xxxxxx          l           es       xxxxxx   00:       xxxxx:
                                                       00        nineteencharacter
                                                                 s
  nin    xxxxxx   Per    d           Un       xxxxxx   197       xxxxxxxx-xxxx-xxxx   false
  ete    xx-xxx   for    r           it       xx-xxx   0-0       -xxxx-xxxxxxxxxxxx
  enc    x-xxxx   man    u           ed       x-xxxx   1-0       :
  har    -xxxx-   cd     p           St       -xxxx-   1         Team,xxxxxxxx-xxxx
  act    xxxxxx   Lar     a           at       xxxxxx   00:       -xxxx-xxxx-xxxxxxx
  ers    xxxxxx   ge     l           es       xxxxxx   00:       xxxxx:
                                                       00        nineteencharacter
                                                                 s
  nin    xxxxxx   Per    d           Un       xxxxxx   197       xxxxxxxx-xxxx-xxxx   false
  ete    xx-xxx   for    r           it       xx-xxx   0-0       -xxxx-xxxxxxxxxxxx
  enc    x-xxxx   man    u           ed       x-xxxx   1-0       :
  har    -xxxx-   ce     p           St       -xxxx-   1         Team,xxxxxxxx-xxxx
  act    xxxxxx   Sma    a           at       xxxxxx   00:       -xxxx-xxxx-xxxxxxx
  ers    xxxxxx   ll     l           es       xxxxxx   00:       xxxxx:
                                                       00        nineteencharacter
                                                                 s
 ------ -------- ------ ----------- -------- -------- --------- -------------------- ------------

irosewfs avatar Feb 25 '22 14:02 irosewfs

Chiming in to say the same behavior is present on Linux. This makes automating tasks that want to do anything with IDs weird, since there's a good chance that using that Terminus command won't get you the full ID.

EDIT: FWIW, I was able to work around it for my case using the --format flag and choosing a different format that didn't have the same behavior.

derytim avatar May 13 '22 18:05 derytim

Worth noting I'm running into this issue using remote:drush but it does not look like the --format flag is available there. (I'm getting the features list and then grep'ing it for "Overridden", but the status column is all dropped down to a single character column.)

darby3 avatar Apr 14 '23 14:04 darby3

Yes, this is possible.

Run:

COLUMNS=9999 terminus site:list

Or:

export COLUMNS=9999

greg-1-anderson avatar Apr 14 '23 21:04 greg-1-anderson

The above works for site:list but doesn't seem to work for a terminus remote:drush command—a Features list squashes the "status" column down to a single character column.

darby3 avatar May 03 '23 14:05 darby3

Yup - Doesn't work for migrate status either:

COLUMNS is also already set my by shell....

$ echo $COLUMNS
272
$ COLUMNS=272 terminus remote:drush SITE.dev ms -- --group=XX
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
 ------------- --------------- -------- ------- ---------- ------------- ---------------
  Group         Migration ID    Status   Total   Imported   Unprocessed   Last Imported
 ------------- --------------- -------- ------- ---------- ------------- ---------------
  Import from   XX_d7_file_ma   Idl      2671    2667       0             2023-07
  XXXXXXXXXXX   naged           e                                         -17
  (XXXXX)                                                                 15:46:0
                                                                          2

Looks like its wrapping at 90 columns?

EDIT: Feels like this should be re-opened?

njt1982 avatar Jul 17 '23 14:07 njt1982

I can also confirm this does not seem to be working for a remote terminus drush command at all. It's always wrapped way smaller.

davereid avatar Sep 19 '23 21:09 davereid

As an aside, note that although Terminus and Drush both use the same output formatter library to render table data, the wordwrap calculation is done separately by each, so column issues with terminus drush are rather different than wordwrap issues with other Terminus commands.

greg-1-anderson avatar Sep 19 '23 21:09 greg-1-anderson

Created LOPS-1697 to track internally.

greg-1-anderson avatar Sep 20 '23 13:09 greg-1-anderson