diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-24 02:52:11 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-24 02:52:11 +0200 |
commit | 30ce25e6df40ff3241b3add7017ac3b5fe6adf2b (patch) | |
tree | ffadeb2af6d9dd294f1acb326e92d1989225f4aa /.local/bin/idea | |
parent | ncmpc update (diff) | |
download | dotfiles-bsd-30ce25e6df40ff3241b3add7017ac3b5fe6adf2b.tar.gz dotfiles-bsd-30ce25e6df40ff3241b3add7017ac3b5fe6adf2b.tar.bz2 dotfiles-bsd-30ce25e6df40ff3241b3add7017ac3b5fe6adf2b.tar.xz dotfiles-bsd-30ce25e6df40ff3241b3add7017ac3b5fe6adf2b.tar.zst dotfiles-bsd-30ce25e6df40ff3241b3add7017ac3b5fe6adf2b.zip |
idea
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/idea | 31 |
1 files changed, 26 insertions, 5 deletions
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<h3>'"${date}"'<\/h3>\ +\t\t\t\t<p>\ +\t\t\t\t\t'"${thought}"'\ +\t\t\t\t<\/p>\ +' +gmi_fmt='\ +\ +## '"${date}"'\ +\ +'"${thought}" + +sed -i '' -e '/<!-- thoughts here -->$/{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 |