lablup / lablup/backend.ai

View print_pagination_list beautifully

Open
#301 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

**Is your feature request related to a problem? Please describe.**`/client-py/src/ai/bakcend/client/output/console.py` has print_pagenation_function. This function generates a table that describes given input from the client's side command line.

But if too many columns have to be fetched, table alignment broke.This picture shows `backend.ai ps` generates readability!https://user-images.githubusercontent.com/37054916/136814635-1c5522b7-8c56-4c94-ac29-d599ca1b8393.png!

Small size terminal shows much more indicative output.![https://user-images.githubusercontent.com/37054916/136817156-f60a49fe-88d5-460b-9156-40b12b4a4da6.png](https://user-images.githubusercontent.com/37054916/136817156-f60a49fe-88d5-460b-9156-40b12b4a4da6.png)

\*Describe the solution you'd like\*A clear and concise description of what you want to happen.

In `/client-py/src/ai/bakcend/client/cli/pagenation.py`, `echo_via_pager` function has been defined. I modified the functionwith ['rich'](https://github.com/willmcgugan/rich) package. The results are as followshttps://github.com/willmcgugan/rich!https://user-images.githubusercontent.com/37054916/136815698-6c6c60f1-9880-475e-ae5f-03fca17f9fed.png!

But several problems still remain here.

1. With `no_wrap = True` option, some of the columns can not be displayed.

1. With `no_wrap = False` option, the alignment of the table is still broken.

(no_wrap is rich's internal option)

\*Describe alternatives you've considered\*A clear and concise description of any alternative solutions or features you've considered.

1.Default `backend.ai ps` fetches too many columns to shows output in a small shell. Can the number of default columns be reduced?

1. Just leave the `echo_via_pager`, make a new function for pretty formatting
**Additional context**

['rich'](https://github.com/willmcgugan/rich) package seems to have a wide variety of uses for this project.

JIRA Issue: BA-286

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.