Open DuckBoss opened 1 year ago
Is the WORKER DATA
field always JSON?
Edit: confirmed for myself; yes, the WorkerEvent.Data field is always parsable as JSON (Go declares it as map[string]string
).
So there's just something odd about these flags that I can't put into words yet. I looked over the CLIG and read the section on command line arguments and flags. It links to some of its source material, which includes an article on good CLI design decisions. This article has a section on table usage. This section talks about output formatting, and includes the following:
Be mindful of the screen width. Only show a few columns by default but allow the user to pass --columns with a comma-separated list of column names to add less common types. Truncate rows that are going to spill over the current screen width unless --no-truncate is set.
Because the table is an interactive output format, perhaps we should default to dynamic truncation, and allow the user to simply pass a --no-truncate
flag if they want to skip the truncation. This does require a rather significant rework of your PR though, but since we never went through any sort of design discussion, I think it's worth having before we get too far into the implementation specifics.
Thanks for the resources, that's definitely a fundamental change to this PR and I agree this is worth having a design discussion first.
I put some thought into this finally. And started a discussion about it (#215).
Do not merge before: https://github.com/RedHatInsights/yggdrasil/pull/116
This feature implements the
--truncate-field
/--tf
and--truncate--all-fields
/--taf
flags. The--truncate-field
flag allows users to truncate worker data content for the specified field to the character count provided. The--truncate-all-fields
flag allows users to truncate all worker data content fields to the character count provided.The
--truncate-field
flag can be used multiple times to truncate content for multiple fields.Example usage:
yggctl message-journal
Output:yggctl message-journal --truncate-field message=5
Output:yggctl message-journal --tf fieldA=2 --tf fieldB=1 --tf fieldC=5
Output:yggctl message-journal --taf 5
Output: