2024-08-01 10:27:38 +02:00
|
|
|
def "is even" [] {
|
|
|
|
$in mod 2 == 0
|
|
|
|
}
|
|
|
|
|
2024-08-01 20:14:38 +02:00
|
|
|
# TODO: flag stuff as module to be used in other stuff in shell
|
|
|
|
|
2024-08-01 10:27:38 +02:00
|
|
|
const TRANS = [ 5BCEFA F5A9B8 FFFFFF F5A9B8 5BCEFA ];
|
|
|
|
const LESBIAN = [ D52D00 EF7627 FF9A56 FFFFFF D162A4 B55690 A30262 ];
|
|
|
|
const ENBY = [ FCF434 FFFFFF 9C59D1 2C2C2C ];
|
|
|
|
|
|
|
|
def flag [
|
|
|
|
colors: list<string>
|
2024-08-02 21:29:25 +02:00
|
|
|
character = "="
|
|
|
|
width = -1,
|
2024-08-01 10:27:38 +02:00
|
|
|
] {
|
|
|
|
use std;
|
|
|
|
|
2024-08-02 21:29:25 +02:00
|
|
|
let out_size = if ($width == -1) {
|
|
|
|
term size | get columns
|
|
|
|
} else { $width };
|
|
|
|
|
|
|
|
let col_size = $out_size / ($colors | length) | math floor;
|
|
|
|
mut rest = $out_size - ($col_size * ($colors | length));
|
2024-08-01 10:27:38 +02:00
|
|
|
|
|
|
|
mut cols = $colors | wrap color | insert width $col_size | flatten;
|
|
|
|
let last = ($colors | length) - 1;
|
|
|
|
|
2024-08-01 20:01:04 +02:00
|
|
|
if not ($rest | is even) {
|
2024-08-01 10:27:38 +02:00
|
|
|
$rest = $rest - 1;
|
|
|
|
|
2024-08-01 20:01:04 +02:00
|
|
|
$cols = (if not ($colors | length | is even) {
|
2024-08-01 10:27:38 +02:00
|
|
|
$cols | update (($colors | length) / 2 | math floor) { $in | update width {|w| ($w.width + 1)}}
|
|
|
|
} else {
|
|
|
|
$cols | update $last { $in | update width {|w| ($w.width + 1)}}
|
2024-08-01 20:01:04 +02:00
|
|
|
});
|
2024-08-01 10:27:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
std assert ($rest | is even);
|
|
|
|
|
|
|
|
let amount = $rest / 2;
|
|
|
|
|
|
|
|
$cols = ($cols | update 0 { $in | update width {|w| ($w.width + $amount) } } | update $last { $in | update width {|w| ($w.width + $amount) } });
|
|
|
|
|
2024-08-02 21:29:25 +02:00
|
|
|
$cols | each {|col|
|
|
|
|
$character | std repeat $col.width | prepend (ansi {fg: $"#($col.color)" }) | str join
|
|
|
|
} | prepend (ansi attr_bold) | append (ansi reset) | str join
|
2024-08-01 10:27:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
def main [] {
|
2024-09-26 19:15:58 +02:00
|
|
|
print (flag $LESBIAN);
|
2024-08-09 20:02:08 +02:00
|
|
|
let next_events = open ~/Docs/dates.csv
|
|
|
|
| update datetime {|ev| $ev.datetime | into datetime }
|
|
|
|
| sort-by datetime
|
2024-09-07 18:32:06 +02:00
|
|
|
| filter {|ev| ($ev.datetime > (date now))}
|
2024-08-09 20:02:08 +02:00
|
|
|
| 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)";
|
2024-08-01 10:27:38 +02:00
|
|
|
}
|
|
|
|
|
2024-08-09 20:02:08 +02:00
|
|
|
def tfmt [dur: duration] {
|
|
|
|
if ($dur < 1hr) {
|
|
|
|
return ($dur | format duration min);
|
|
|
|
} else if ($dur < 1day) {
|
|
|
|
return ($dur | format duration hr);
|
|
|
|
} else {
|
|
|
|
return ($dur | format duration day);
|
|
|
|
}
|
|
|
|
}
|