summaryrefslogtreecommitdiff
path: root/i
diff options
context:
space:
mode:
Diffstat (limited to 'i')
-rwxr-xr-xi15
1 files changed, 15 insertions, 0 deletions
diff --git a/i b/i
new file mode 100755
index 0000000..1420dd5
--- /dev/null
+++ b/i
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+set -e
+
+readonly NOTES_DIRECTORY="${NOTES_DIRECTORY:-"${HOME}/notes"}"
+readonly NOTES_PATH="${NOTES_DIRECTORY}/@inbox.txt"
+
+if [ ${#} -eq 0 ]; then
+ if [ -p "/dev/stdin" ]; then
+ (cat; printf "\n\n") >> "${NOTES_PATH}"
+ else
+ eval "${EDITOR} '+normal G$' +startinsert " "${NOTES_PATH}"
+ fi
+else
+ printf "%s\n" "${*}" >> "${NOTES_PATH}"
+fi