Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Columns of different option groups do not align #34

Open
apcamargo opened this issue Mar 3, 2022 · 3 comments
Open

Columns of different option groups do not align #34

apcamargo opened this issue Mar 3, 2022 · 3 comments
Labels
help wanted Extra attention is needed low priority

Comments

@apcamargo
Copy link
Contributor

When I split my options across different groups the columns are not aligned between them. In the example below, the metavar and the description columns of the Basic options and Advanced options groups are not aligned.

╭─ Basic options ──────────────────────────────────────────────────────────────────────────────────╮
│  --restart                          Overwrite existing intermediate files. [default: False]      │
│  --threads          -t     INTEGER  Number of threads to use. [default: 16]                      │
│  --verbose/--quiet  -v/-q           Display the execution progress. [default: verbose]           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Advanced options ───────────────────────────────────────────────────────────────────────────────╮
│  --sensitivity  -s  FLOAT  Search sensitivity. [default: 3.5]                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
@ewels
Copy link
Owner

ewels commented Mar 3, 2022

Yeah, I'm aware of this one. However, I haven't been able to think of a good way to standardise it. The columns in the different panels are totally separate and I want the widths to be flexible to best accommodate the content.

Any suggestions welcome!

@ewels ewels added the help wanted Extra attention is needed label Mar 3, 2022
@apcamargo
Copy link
Contributor Author

apcamargo commented Mar 3, 2022

I just noticed that the issue becomes even harder when there's a required option that adds a *:

╭─ Other ──────────────────────────────────────────────────────────────────────────────────────────╮
│  --help     -h    Show this message and exit.                                                    │
│  --version        Show the version and exit.                                                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│  *  --input      -i  TEXT  Input path [required]                                                 │
│     --output     -o  TEXT  Output path                                                           │
│     --all                  Sync all the things?                                                  │
│     --overwrite            Overwrite local files                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

I guess the best thing to to would be to get all the different types of columns used by all the groups and apply them to each group. I'm not too familiar with click's API, tough 😕

@ewels
Copy link
Owner

ewels commented Mar 3, 2022

That one is a bit easier - the code strips the first column if none are required to avoid an unnecessary column of whitespace. But it still wouldn't be exactly the same width even if we kept it.

The only idea I have is to make one massive table with everything, somehow figure out the dynamically chosen column widths, then discard it without printing and apply those widths to all tables. But I'm not sure if it's possible to get widths like that from rich (it probably is, you can do most things).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed low priority
Projects
None yet
Development

No branches or pull requests

2 participants