From e73a37b06e7282ef3212ac8e33e81d14f932fcd2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 18 Mar 2023 18:21:21 +0200 Subject: refactor --- guprecords.raku | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/guprecords.raku b/guprecords.raku index b74fa03..50b99e1 100644 --- a/guprecords.raku +++ b/guprecords.raku @@ -92,7 +92,7 @@ class Aggregator { } class Reporter { - has Category $.cat is required; + has Category $.cat = 'host'; has Metric $.metric is required; has Natural $.limit is required; has Hash %.aggregates; @@ -167,19 +167,19 @@ sub do-it(Str:D \stats-dir, Reporter:D \reporter) { reporter.report; } -multi MAIN( - Str :$stats-dir is required, - HostMetric :$metric = 'uptime', - Natural :$limit = 20, -) { - do-it($stats-dir, HostReporter.new(cat => 'host', :$metric, :$limit)); -} - multi MAIN( Str :$stats-dir is required, #= The uptimed raw record input dir. Category :$cat is required where * ne 'host', #= The category, one of host, os, os-major, uname [default: 'host'] Metric :$metric = 'uptime', #= The metric, one of boots, uptime, meta-score, downtime, lifespan Natural :$limit = 20, #= Limit output to num of entries. ) { - do-it($stats-dir, HostReporter.new(:$cat, :$metric, :$limit)); + do-it($stats-dir, Reporter.new(:$cat, :$metric, :$limit)); +} + +multi MAIN( + Str :$stats-dir is required, + HostMetric :$metric = 'uptime', + Natural :$limit = 20, +) { + do-it($stats-dir, HostReporter.new(:$metric, :$limit)); } -- cgit v1.2.3