summaryrefslogtreecommitdiffstats
path: root/.local/bin/idea
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/idea')
-rwxr-xr-x.local/bin/idea34
1 files changed, 18 insertions, 16 deletions
diff --git a/.local/bin/idea b/.local/bin/idea
index c3fc9b4..91f8244 100755
--- a/.local/bin/idea
+++ b/.local/bin/idea
@@ -1,32 +1,34 @@
#!/bin/sh -e
-if [ -z "$1" ]; then
+title="untitled"
+
+if [ -z "$2" ]; then
thought=$(cat -)
-elif [ -f "$1" ]; then
- thought=$(cat "$1")
+ title="$1"
+elif [ -f "$2" ]; then
+ thought=$(cat "$2")
+ title="$1"
else
- thought="$*"
+ thought="${*:2}"
+ title="$1"
fi
thought="$(printf "%s" "${thought}" | sed '{s#^#\\t\\t\\t\\t\\t#;s#^\\t\\t\\t\\t\\t$#\\t\\t\\t\\t</p>\\\n\\t\\t\\t\\t<p>#;s#$#\\#;}')"
date=$(date '+%a, %d %b %Y %H:%M')
-html_fmt='\t\t\t\t<h3>'"${date}"'</h3>\
+html_fmt='\t\t\t\t<h3>'"${title}"'</h3>\
+\t\t\t\t<h5>'"${date}"'</h5>\
\t\t\t\t<p>\
'"${thought}"'
\t\t\t\t</p>\
'
rss_fmt='\\t<item>\
-\t <title>'"${date}"'</title>\
-\t <pubDate>'"${date} $(date '+%Z')"'</pubDate>\
-\t <link>http://jozan.org/thoughts.html</link>\
-\t <guid isPermalink="false">'"$(uuidgen)"'</guid>\
-\t <description>\
-\t\t<![CDATA[\
-\t\t\t\t<p>\
-'"${thought}"'
-\t\t\t\t</p>\
-\t\t]]>\
-\t </description>\
+\t\t<title>'"${title}"'</title>\
+\t\t<pubDate>'"${date} $(date '+%Z')"'</pubDate>\
+\t\t<author>joe</author>
+\t\t<guid isPermalink="false">'"$(uuidgen)"'</guid>\
+\t\t<description>\
+\t\t\t'"${thought}"'
+\t\t</description>\
\t</item>
'