feat: adjust gridtk list output to fit terminal width#15
Conversation
Fixes #13 Adjust the `gridtk list` output to fit terminal width and add a `--full-output` option. * **src/gridtk/cli.py** - Update the `list_jobs` function to adjust column widths based on terminal size. - Add logic to truncate long content with ellipses in the `list_jobs` function. - Add a new option `--full-output` to the `list_jobs` command to view the full output without truncation. * **tests/test_gridtk.py** - Add unit tests to verify the new behavior of the `gridtk list` command. - Add unit tests to verify the `--full-output` option for the `gridtk list` command. * **README.md** - Update the documentation to reflect the new behavior of the `gridtk list` command. - Add information about the `--full-output` option for the `gridtk list` command. * **.devcontainer.json** - Add a devcontainer configuration file with tasks for testing, building, and launching the project. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/idiap/gridtk/issues/13?shareId=XXXX-XXXX-XXXX-XXXX).
…mmand for improved readability Also, adjust max column widths for output formatting to accommodate new options
* truncates with only 2 dots * dynamically adjusts the command column to use all the width of the terminal
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
Yannick-Dayer
left a comment
There was a problem hiding this comment.
I must have missed the mail for that review.
This is a nice feature!
When testing it however, I noticed issues with both --wrap and --truncate options when using a small terminal width (<=87 for truncate, and <=95 for wrap). The total width somehow exceeds the width of the terminal and wraps some full lines (like the header separator).

With a terminal width of 95 and the --wrap option. Notice the - of the header separator and the t of submit.
I think this is due to tabulate adding some horizontal padding to some columns despite specifying their maxcolwidths parameters.
|
Yes, I have found the output of tabulate quite unpreditable regarding this. Not sure what to do here. |
|
could you show a before and after photo? I am not sure I understand what changed. |
Yannick-Dayer
left a comment
There was a problem hiding this comment.
Sorry, I dropped that.
I did test it and it works great except in the cases stated above.
If the issue with smaller terminal width is not too bad for you, I'm approving it and you can merge.

Fixes #13. By default,
gridtk listoutputs a table which migh not fit the terminal width.This PR adds options to adjust the output using the
--wrapand--truncateflags. The--wrapflag wraps the output to fit the terminal width, while the
--truncateflagtruncates the output to fit the terminal width.
📚 Documentation preview 📚: https://gridtk--15.org.readthedocs.build/en/15/