troycomi / reportseff

Tabular seff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow text cropping from both sides

janosh opened this issue · comments

Besides alignment with > and <, it would be cool if we could set whether to crop long text from the left or right. Current default is cropping the end (i.e. from right) but for --format WorkDir, it's usually more interesting to see the end of a directory name.

Good point; I hadn't used workdir before.

In terms of syntax, what would make sense? I'm thinking like WorkDir%20e with the e signifying end with default being start. $ may be more standard but then would have to use string literals for the arguments.

e at the end sounds intuitive and easy to remember to me. 👍

Btw, how come you use HTML tags instead of markdown native code fences for tables?

<pre><b>     Name           State          Time       CPU    Memory</b>
       XXXXX000   COMPLETED       00:01:53   97.3%    14.0%
       XXXXX001   COMPLETED       00:02:19   84.2%    14.0%
       XXXXX002   COMPLETED       00:06:33   28.2%    14.0%
       XXXXX003   COMPLETED       00:04:59   39.1%    14.0%
       XXXXX004   COMPLETED       00:02:31   97.4%    9.2%
       XXXXX005   COMPLETED       00:02:38   98.1%    9.1%
       XXXXX006   COMPLETED       00:02:24   97.2%    9.1%
       XXXXX007   COMPLETED       00:02:40   98.1%    9.0%
       XXXXX008   COMPLETED       00:02:39   96.2%    9.1%
       XXXXX009   COMPLETED       00:02:45   96.4%    9.0%
       XXXXX012   COMPLETED       00:00:53   58.5%    10.6%
       XXXXX013   COMPLETED       00:02:13   38.3%    10.6%
       XXXXX014   COMPLETED       00:37:02   44.9%    10.6%
       XXXXX015   COMPLETED       00:44:33   34.0%    10.6%
       XXXXX016   COMPLETED       00:38:29   29.6%    10.7%
       XXXXX017   COMPLETED       00:19:57   74.5%    10.8%
       XXXXX018   COMPLETED       00:14:25   95.0%    10.8%
       XXXXX019   COMPLETED       00:35:38   2.6%     10.6%
       XXXXX020   COMPLETED       00:02:16   38.2%    10.6%
       XXXXX021   COMPLETED       00:02:34   46.1%    10.9%
       XXXXX022   COMPLETED       00:20:53   7.1%     10.6%
       XXXXX023   COMPLETED       00:01:00   95.0%    11.1%
       XXXXX024   COMPLETED       00:09:06   88.5%    10.5%
       XXXXX025   COMPLETED       00:08:08   95.3%    10.6%
</pre>

Wouldn't this be cleaner?

```txt
Name           State          Time     CPU     Memory
XXXXX000   COMPLETED       00:01:53   97.3%    14.0%
XXXXX001   COMPLETED       00:02:19   84.2%    14.0%
XXXXX002   COMPLETED       00:06:33   28.2%    14.0%
XXXXX003   COMPLETED       00:04:59   39.1%    14.0%
XXXXX004   COMPLETED       00:02:31   97.4%    9.2%
XXXXX005   COMPLETED       00:02:38   98.1%    9.1%
XXXXX006   COMPLETED       00:02:24   97.2%    9.1%
XXXXX007   COMPLETED       00:02:40   98.1%    9.0%
XXXXX008   COMPLETED       00:02:39   96.2%    9.1%
XXXXX009   COMPLETED       00:02:45   96.4%    9.0%
XXXXX012   COMPLETED       00:00:53   58.5%    10.6%
XXXXX013   COMPLETED       00:02:13   38.3%    10.6%
XXXXX014   COMPLETED       00:37:02   44.9%    10.6%
XXXXX015   COMPLETED       00:44:33   34.0%    10.6%
XXXXX016   COMPLETED       00:38:29   29.6%    10.7%
XXXXX017   COMPLETED       00:19:57   74.5%    10.8%
XXXXX018   COMPLETED       00:14:25   95.0%    10.8%
XXXXX019   COMPLETED       00:35:38   2.6%     10.6%
XXXXX020   COMPLETED       00:02:16   38.2%    10.6%
XXXXX021   COMPLETED       00:02:34   46.1%    10.9%
XXXXX022   COMPLETED       00:20:53   7.1%     10.6%
XXXXX023   COMPLETED       00:01:00   95.0%    11.1%
XXXXX024   COMPLETED       00:09:06   88.5%    10.5%
XXXXX025   COMPLETED       00:08:08   95.3%    10.6%
```

Initially it was to try to display the color of each column, but since github markdown didn't support it I deleted the color tags. Left in the preformat tag to display at least the bolded column names. Good suggestion though.

Implemented in 5d50d84

Open a new issue if something seems off. Thanks for all the work and interest!