-
Notifications
You must be signed in to change notification settings - Fork 71
Description
tl;dr
It has been proposed that when the count operator is used without an argument it should produce output like this:
$ echo '{foo:"bar",a:"b"} {foo:"baz",a:"c"}' | super -c 'count' -
{that:{foo:"bar",a:"b"},count:1::uint64}
{that:{foo:"baz",a:"c"},count:2::uint64}
Details
At the time this issue is being opened, super is at commit 30f64bb.
The count operator added in #6344 currently requires an argument in record syntax that specifies the name of a record field to hold the numeric count and optional additional elements that determine what becomes of the input value. However, to spare the user from having to remember the record syntax, it's been proposed that count without argument would behave as shown above where the input value would be embedded under a field called that (per conventions for derived field names) and the numeric count would be placed in a field called count.
If the user called count in that simplified manner and actually wanted to spread an input record value next to the numeric count, it's expected they'd tack on something like:
$ echo '{foo:"bar",a:"b"} {foo:"baz",a:"c"}' | super -c 'count | values {...that,count}' -
{foo:"bar",a:"b",count:1::uint64}
{foo:"baz",a:"c",count:2::uint64}
If the user wants to assign a name to the numeric count field and do values-like output assembly all in one shot, an optional argument to count in record syntax would still be available, e.g.,
$ echo '{foo:"bar",a:"b"} {foo:"baz",a:"c"}' | super -c 'count {foo,a,cnt}' -
{foo:"bar",a:"b",cnt:1::uint64}
{foo:"baz",a:"c",cnt:2::uint64}