Added summary and total rows to top command. #94
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.
This PR makes a few changes to the
top
sub-command in order to introduce a summary of remaining items when the output is truncated, and a row containing a total of all items. If the retaining size is being used, then these columns will only show "..." in the emitted table.Other minor changes include changing the name of the
number
field tomax_items
, for the sake of consistency with other sub-commands. This has also been changed from anOption<u32>
into a plainu32
value. In order to prevent a breaking change from introducing truncation where there previously was none, this defaults tou32::MAX
.I refrained from doing so in this PR, but it seems like a good idea to decide on a consistent default for the maximum number of items to display.
diff
for example, defaults to 20, while others show 10. Once an--all
flag is introduced, we can go about doing this, and update the test cases as well.Other note: For now, I kept the
TableRow
struct internal to the text emission function, but this could eventually be refactored out into an entry struct similar to theDiffEntry
andMonosEntry
structs shortly, assuming the csv and json emission eventually use it as well.(This relates to #88)