diff --git a/other/scripts/desktop/shell-startup.nu b/other/scripts/desktop/shell-startup.nu index debcf05..133f149 100644 --- a/other/scripts/desktop/shell-startup.nu +++ b/other/scripts/desktop/shell-startup.nu @@ -39,10 +39,10 @@ def flag [ let amount = $rest / 2; - $cols = ($cols | update 0 { $in | update width {|w| ($w.width + $amount) } } | update $last { $in | update width {|w| ($w.width + $amount) } }); + $cols = ($cols | update 0 { $in | update width {|w| (($w.width | into int) + $amount) } } | update $last { $in | update width {|w| ($w.width + $amount) } }); $cols | each {|col| - $character | std repeat $col.width | prepend (ansi {fg: $"#($col.color)" }) | str join + $character | std repeat ($col.width | into int) | prepend (ansi {fg: $"#($col.color)" }) | str join } | prepend (ansi attr_bold) | append (ansi reset) | str join } @@ -51,10 +51,14 @@ def main [] { let next_events = open ~/Docs/dates.csv | update datetime {|ev| $ev.datetime | into datetime } | sort-by datetime - | filter {|ev| ($ev.datetime > (date now))} - | first - | each {|ev| $"(ansi attr_bold)($ev.event)(ansi reset) in (ansi attr_bold)(tfmt ($ev.datetime - (date now)))s(ansi reset)" }; - print $"Hi jade, you're on HRT for (ansi reset)(ansi attr_bold)((date now) - ('2024-02-18T20:53' | into datetime) | format duration month)s(ansi reset) now! | Next Event: ($next_events)"; + | filter {|ev| ($ev.datetime > (date now))}; + + let evstr = if ($next_events | is-not-empty) { + let ev = $next_events | first; + $" | Next Event: (ansi attr_bold)($ev.event)(ansi reset) in (ansi attr_bold)(tfmt ($ev.datetime - (date now)))s(ansi reset)" + } else ""; + + print $"Hi jade, you're on HRT for (ansi reset)(ansi attr_bold)((date now) - ('2024-02-18T20:53' | into datetime) | format duration month)s(ansi reset) now!($evstr)"; } def tfmt [dur: duration] {