Replace links alias with a function of optional arg
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 20 Nov 2024 16:07:30 +0000 (11:07 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 20 Nov 2024 16:07:30 +0000 (11:07 -0500)
home/lib/login_aliases.sh
home/lib/login_functions.sh

index 74bfa2c..8710e04 100644 (file)
@@ -29,7 +29,6 @@ alias bitcoin='nc ticker.bitcointicker.co 10080'  # https://github.com/chubin/aw
 alias weather='cat ~/.pista-out/weather-summary'
 alias sccache-restart='sccache --stop-server; sccache --start-server'
 alias nightshift=sct
-alias links='vim ~/arc/doc/links/"$(date +%F)"'
 alias gh-clone-repo=gh_clone_repo
 alias gh-clone-user=gh_clone_user
 alias gh-clone-org=gh_clone_org
index e518135..122331f 100644 (file)
@@ -15,6 +15,15 @@ emoji() {
     khomenu < ~/emoji.txt | awk '{print $1}' | xsel --input --clipboard
 }
 
+links() {
+    local -r file="$HOME"/arc/doc/links/"$(date +%F)"
+
+    case "$1" in
+        '') vim "$file";;
+        *) echo "$1" >> "$file";;
+    esac
+}
+
 links_aggregate_md() {
     printf 'Daily Links\n'
     printf '%s\n' "$(bar 78 '=')"
This page took 0.020097 seconds and 4 git commands to generate.