From 30ce25e6df40ff3241b3add7017ac3b5fe6adf2b Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 24 Apr 2022 02:52:11 +0200 Subject: idea --- .local/bin/idea | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to '.local/bin/idea') diff --git a/.local/bin/idea b/.local/bin/idea index 7fdd039..e2853a1 100755 --- a/.local/bin/idea +++ b/.local/bin/idea @@ -1,12 +1,33 @@ -#!/usr/local/bin/dash -e +#!/bin/sh -e -[ -z "$1" ] && echo 'Thought needed' && exit 1 +if [ -z "$1" ]; then + read -r thought +elif [ -f "$1" ]; then + thought=$(cat "$1") +else + thought="$*" +fi -nl=' -' date=$(date) +html_fmt='\t\t\t\t

'"${date}"'<\/h3>\ +\t\t\t\t

\ +\t\t\t\t\t'"${thought}"'\ +\t\t\t\t<\/p>\ +' +gmi_fmt='\ +\ +## '"${date}"'\ +\ +'"${thought}" + +sed -i '' -e '/$/{n;s/^/'"${html_fmt}"'/;}' \ + "$HOME"/dev/web/jozanofastora.xyz/thoughts.html +git -C "$HOME"/dev/web/jozanofastora.xyz add -u +git -C "$HOME"/dev/web/jozanofastora.xyz commit -m "Thought: ${date}" +git -C "$HOME"/dev/web/jozanofastora.xyz push -sed -i '' -e '15i '"\\${nl}\\${nl}"'## '"\\${date}"' '"\\${nl}\\${nl}\\${1}" "$HOME"/dev/web/jozan_gemini/thoughts.gmi +sed -i '' -e '15i '"${gmi_fmt}" \ + "$HOME"/dev/web/jozan_gemini/thoughts.gmi git -C "$HOME"/dev/web/jozan_gemini add -u git -C "$HOME"/dev/web/jozan_gemini commit -m "Thought: ${date}" git -C "$HOME"/dev/web/jozan_gemini push -- cgit v1.2.3