]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: change motd to org TODO list
authorSamir Benmendil <me@rmz.io>
Sat, 15 Feb 2020 21:15:49 +0000 (21:15 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 15 Feb 2020 21:15:49 +0000 (21:15 +0000)
zsh/lib/motd.zsh

index 24eef9c8e0b7514c25a9a9624a26c0e2221b5a5d..1c6e9e4349ef31ac018dc4c8321b0ac854cab493 100644 (file)
@@ -10,78 +10,5 @@ msg()
   print "$fg_bold[white]$1$reset_color\n$2\n"
 }
 
   print "$fg_bold[white]$1$reset_color\n$2\n"
 }
 
-function () {
-    function c()
-    {
-        local rand=$(od -An -t u1 -N1 /dev/urandom)
-        local idx=$((1 + (rand % $#)))
-        echo ${@[$idx]}
-    }
-
-    recurring_event=(
-        "the $(c fall spring) equinox"
-        "the $(c winter summer) $(c solstice olympics)"
-        "the $(c erliest latest) $(c sunrise sunset)"
-        "the daylight $(c saving savings) time"
-        "the leap $(c day year)"
-        "easter"
-        "the $(c harvest super blood) moon"
-        "Toyota Truck Month"
-        "Shark Week"
-    )
-    drifters=(
-        sun
-        moon
-        zodiac
-        "$(c gregorian mayan lunar iPhone) calendar"
-        "atomic clock in Colorado"
-    )
-    unusual_manner=(
-        "happens $(c earlier later "at the wrong time") every year"
-        "drifts out of sync with the $(c ${drifters[@]})"
-        "might $(c "not happen" "happen twice") this year"
-    )
-    ions_and_ities=(precession libration nutation libation eccentricity obliquity)
-    iees_and_itees=(
-        moon
-        sun
-        "earth's axis"
-        equator
-        "prime meridian"
-        "$(c "international date" "Mason-Dixon") line"
-    )
-
-    phenomenon=(
-        "time zone legislation in $(c Indiana Arizona Russia)"
-        "a decree by the Pope in the 1500s"
-        "$(c ${ions_and_ities[@]}) of the $(c ${iees_and_itees[@]})"
-        "magnetic field reversal"
-        "an arbitrary decision by $(c "Benjamin Franklin" "Isaac Newton" "FDR")"
-    )
-    excuse=(
-        "will never happen"
-        "actually makes things worse"
-        "is stalled in congress"
-        "might be unconstitutional"
-    )
-    statement=(
-        "it causes a predictable increase in car accidents"
-        "that's why we have leap seconds"
-        "scientists are really worried"
-        "it was even more extreme during the $(c "bronze age" "ice age" cretaceous 1990s)"
-        "there's a proposal to fix it, but it $(c ${excuse[@]})"
-        "it's getting worse and no one knows why"
-    )
-    consequence=(
-        "causes huge headaches for software developers"
-        "is taken advantage of by high-speed traders"
-        "triggered the 2003 Northeast Blackout"
-        "has to be corrected for by GPS satellites"
-        "is now recognized as a major cause of World War I"
-    )
-    autoload zmathfunc
-    which zsh_math_func_min >/dev/null || zmathfunc
-    echo -n "Did you know that $(c ${recurring_event[@]}) $(c ${unusual_manner[@]})" \
-        "because of $(c ${phenomenon[@]})?  Apparently $(c ${statement[@]}). " \
-        "While it may seem like trivia, it $(c ${consequence[@]})." | fmt -w $((min(COLUMNS, 80)))
-}
+# 44 seems to be the number of color escape characters used by grep
+grep "* TODO" org/* --color=always | cut -c-$((COLUMNS + 44))