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

CLI: Add in support for selective column output #1085

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

ikelos
Copy link
Member

@ikelos ikelos commented Jan 15, 2024

This adds support for selective column output on the CLI. Other UIs are welcome to implement their own features. Still to add to this is the ability for plugins to provide their own list of expected columns (currently, all columns are output by default).

@ikelos ikelos linked an issue Jan 17, 2024 that may be closed by this pull request
@ikelos
Copy link
Member Author

ikelos commented Jan 31, 2024

Still want to do a little work on this to allow plugins to have a default set of columns and then a --all flag or something to display all columns from a plugin. Not sure whether I should make that something passed to the TreeGrid or not...

@ikelos ikelos marked this pull request as draft February 9, 2024 18:07
This adds the ability to provide a third argument in the column
definition ("name", "type", "extra").  Extra columns will not be shown
by the CLI by default, but can be seen by passing an empty list to the
CLI (ie, provide no parameters to the `--columns` flag).  Otherwise any
columns passed to `--columns` will be displayed and no other columns
will.  If no valid column name are passed to columns, then the normal
list of columns (not including extra) will be displayed.

All other UIs will need to implement support for the extra column,
otherwise they will silently ignore it.
@ikelos
Copy link
Member Author

ikelos commented Feb 18, 2024

There's now the ability for plugins to say whether a particular column should be displayed or not (although this is for the UI to decide how to interpret). The plugin will still output all data, and it's the UI's job to decide what the user sees based on how it decides to display the data. The CLI will now display all columns except those marked as extra within the plugin (by creating a column with a third boolean parameter set to true). This means that the tree grid is still defined early and ideally should not be altered between runs of a plugin. To display all columns, pass in --columns without any parameters, this must not be the last or only parameter to the CLI, or it will interpret the plugin name as a column name and say that no plugin name has been provided. This is like all other list parameters, but this is one of the only CLI parameters that accepts a list. No plugins currently mark any columns as extra. Since the additional value for making columns is an API change, plugins making use of it must depend on the appropriate version.

I'm still not sure I really like this, I skirted actually implementing renderer options because it would be a lot of work to define them properly, they need to be able to take in user input as well as pass data from the plugin itself in this instance, and it would probably have a significant impact on plugins, whereas at the moment this is quite minimal. Still uncertain about the whole thing though (and the way of displaying all columns in the CLI is a little awkward). The good news is it shouldn't impact any other UIs at all.

@ikelos ikelos added the Minor API bump When the API changes in an additive (backwards compatible) only way label Feb 18, 2024
@ikelos ikelos marked this pull request as ready for review February 18, 2024 22:18
Slightly heavier weight classes rather than tuples, but allows greater
flexibility and future assignment of new attribtues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor API bump When the API changes in an additive (backwards compatible) only way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build a UI based way of choosing columns to display
1 participant