Merge branch 'main' of ssh://git.trivernis.net:22321/Trivernis/dotfiles-silo

main
trivernis 9 months ago
commit 7e3413d5e8
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -31,3 +31,15 @@ scope = "source.glimmer"
[[grammar]] [[grammar]]
name = "glimmer" name = "glimmer"
source = { git = "https://github.com/alexlafroscia/tree-sitter-glimmer", rev = "f9746dc1d0707717fbba84cb5c22a71586af23e1" } source = { git = "https://github.com/alexlafroscia/tree-sitter-glimmer", rev = "f9746dc1d0707717fbba84cb5c22a71586af23e1" }
[[language]]
name = "roc"
language-servers = []
auto-format = false
indent = { tab-width = 4, unit = " " }
file-types = ["roc"]
scope = "source.elm"
grammar = "elm"
comment-token = "#"
roots = []

@ -1,4 +1,34 @@
let fact = (try { http get https://uselessfacts.jsph.pl/api/v2/facts/random | get text } catch { "I wasn't able to provide a fact." }); def print-fact [] {
echo $"Hello (ansi purple_bold)({{#if flags.windows}}$env.USERNAME{{else}}$env.USER{{/if}})(ansi reset), let username = {{#if flags.windows}}$env.USERNAME{{else}}$env.USER{{/if}}
echo $"Hello (ansi purple_bold)($username)(ansi reset),
it's the (ansi purple_bold)(date now | format date '%d.%m.%Y')(ansi reset) at (ansi purple_bold)(date now | format date '%H:%M:%S')(ansi reset) it's the (ansi purple_bold)(date now | format date '%d.%m.%Y')(ansi reset) at (ansi purple_bold)(date now | format date '%H:%M:%S')(ansi reset)
Did you know: (ansi purple_bold)($fact)(ansi reset)" Did you know: (ansi purple_bold)(fact)(ansi reset)"
}
def fact [] {
let cache_file = '{{dirs.data}}' | path join facts.txt
if not ($cache_file | path exists) {
touch $cache_file
}
mut all_facts = open $cache_file | lines
if ($all_facts | length) < 4 {
try {
$all_facts = (fetch-facts | prepend $all_facts)
} catch {|e|
print -e $"Failed to refresh facts cache ($e)"
}
}
$all_facts | skip 1 | str join "\n" | save -f $cache_file
if ($all_facts | is-empty) {
"I wasn't able to provide a fact."
} else {
$all_facts | first
}
}
def fetch-facts [num_facts: number = 10] {
0..($num_facts) | par-each { http get https://uselessfacts.jsph.pl/api/v2/facts/random | get text }
}
print-fact

Loading…
Cancel
Save