Open hangxie opened 3 weeks ago
I assume this is meant to address #54 in a more general way, since the median is the 50th percentile, or was this PR an independent initiative?
I agree that Sort and Filter should probably be separate steps/functions, but you don't have to address it in this PR. I can do that later. Sort could also use the simpler slices.Sort (since Go 1.21) nowadays.
The output probably needs a label, analogous to the "Average: " label for -avg.
The question is if we need a short option as well. I'm not sure how people want to use it: Do they just want to look at the output on the command line or parse it for further processing in a pipeline?
Committed a new change to have label for percentile, also include centile-short
to eliminate label, I don't think the change is perfect but it works.
A couple other thoughts triggered but the new commit:
-json
to output things in JSON format, it can make life easier when people want to parse output*-short
with a global no-label
CLI parameter, this will break backward compatibility though and may have a sematic problem, like user asks for avg and 90-th percentile, without label we will have to document their sequence in output.Let me know if you want me rebase to squash to single commit.
Add this flag to show percentile.
Other thought - if gocyclo plans to support more stats features,
SortAndFilter
would be better split intoSort
andFilter
.