summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-02-12 13:56:35 +0200
committerPaul Buetow <paul@buetow.org>2023-02-12 13:56:35 +0200
commitc21cce5a669e5613d3c9e1bf404a086893b5bef5 (patch)
treef8c9216f048b240bbd6700d06c6ccb375be5eb82
parente3807941a06c29e8db600b17a5fbd386e8849ac1 (diff)
add ideas
-rw-r--r--src/guprecords.raku18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/guprecords.raku b/src/guprecords.raku
index 3d0ccd1..19718b5 100644
--- a/src/guprecords.raku
+++ b/src/guprecords.raku
@@ -28,7 +28,7 @@ class Aggregate {
method lifespan { self.downtime + $.uptime }
method Str returns Str {
- my Str $active = self!is-active ?? '* ' !! ' ';
+ my Str $active = self!is-active ?? '*' !! ' ';
return "$active {$!name}\t{duration($!uptime)} {$!uptime}"
}
@@ -73,11 +73,17 @@ class Aggregator {
}
}
-role Sorting {
+class Reporter {
has Hash %.aggregates is required;
has Cat $.cat is required;
has SubCat $.sub-cat is required;
+ method report {
+ for self.sort-by($!sub-cat) -> $what {
+ $what.Str.say;
+ }
+ }
+
multi method sort-by('uptime') { self.sort-by: *.uptime }
multi method sort-by('downtime') { self.sort-by: *.downtime }
multi method sort-by('lifespan') { self.sort-by: *.lifespan }
@@ -88,14 +94,6 @@ role Sorting {
}
}
-class Reporter does Sorting {
- method report {
- for self.sort-by($!sub-cat) -> $what {
- $what.Str.say;
- }
- }
-}
-
sub MAIN(
Str :$stats-dir is required, #= The uptimed raw record input dir.
Cat :$cat = 'hostname'; #= Category, one of hostname, os os-major and uname.