CLI: Improve the quality of verdi code list
output
#5750
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The output of
verdi code list
was being formatted "by hand" and as a result was quite different from the output of other commands that typically use thetabulate
library to do the formatting.The command is refactored to use
tabulate
. A single query is created which is more readable compared to the old logic and filters for each of the entities are built up consistently based on the options passed to the command.The
-P/--project
option is added. Just as forverdi proces list
this option allows to control which properties of the query are projected and printed to stdout. This means that the-o/--show-owner
option is no longer needed and so is deprecated. It can be replaced by using-P user
with the new option.The new option also allows projecting the "entry_point" of the
Code
instances that are matched by the query. This has become interesting since recently theAbstractCode
class allows plugins to provide custom implementations registered through an entry point.