Modify all notes scripts to use arbnote
This commit is contained in:
parent
1c8db3fb24
commit
515814ed04
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
NOTETYPE="${1-}"
|
||||||
|
if [[ "$NOTETYPE" == "daily" ]]; then
|
||||||
|
DATESTRING="$(date +%Y/%m/%d)"
|
||||||
|
NOTEHEAD=" for $DATESTRING"
|
||||||
|
elif [[ "$NOTETYPE" == "monthly" ]]; then
|
||||||
|
DATESTRING="$(date +%Y/%m)"
|
||||||
|
NOTEHEAD=" for $DATESTRING"
|
||||||
|
elif [[ "$NOTETYPE" == "yearly" ]]; then
|
||||||
|
DATESTRING="$(date +%Y)"
|
||||||
|
NOTEHEAD=" for $DATESTRING"
|
||||||
|
elif [[ "$NOTETYPE" == "global" ]]; then
|
||||||
|
DATESTRING=""
|
||||||
|
NOTEHEAD=""
|
||||||
|
else
|
||||||
|
echo "usage: arbnote <type> [notename]"
|
||||||
|
echo " create or edit a note"
|
||||||
|
echo " arbnote --help"
|
||||||
|
echo " print this help"
|
||||||
|
echo " "
|
||||||
|
echo "arbnote requires a type: daily, monthly, yearly, or global"
|
||||||
|
echo "if not provided, type is used for notename, too"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
||||||
|
NOTEKIND="$1"
|
||||||
|
NOTENAME="${2:-$NOTETYPE}"
|
||||||
|
DATEDIR="$NOTESDIR/$DATESTRING"
|
||||||
|
mkdir -p "$DATEDIR"
|
||||||
|
NOTEPATH="$DATEDIR/$NOTENAME"
|
||||||
|
echo "$NOTEPATH"
|
||||||
|
if ! [ -f "$NOTEPATH" ]; then
|
||||||
|
printf "$NOTENAME$NOTEHEAD\n---\n\n" > "$NOTEPATH"
|
||||||
|
fi
|
||||||
|
$EDITOR "$NOTEPATH"
|
12
daynote
12
daynote
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
|
||||||
NOTENAME="${1:-daily}"
|
|
||||||
DATEDIR="$NOTESDIR/$(date +%Y/%m/%d)"
|
|
||||||
mkdir -p "$DATEDIR"
|
|
||||||
NOTEPATH="$DATEDIR/$NOTENAME"
|
|
||||||
echo "$NOTEPATH"
|
|
||||||
if ! [ -f "$NOTEPATH" ]; then
|
|
||||||
printf "$NOTENAME for $(date +%Y/%m/%d)\n---\n\n" > "$NOTEPATH"
|
|
||||||
fi
|
|
||||||
$EDITOR "$NOTEPATH"
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
if [ "${1-}" == "--help" ] || [ "${1-}" == "-h" ]; then
|
||||||
|
echo "usage: dnote [notename]"
|
||||||
|
echo " create a daily note in \$NOTESDIR/year/month/day"
|
||||||
|
echo " default \$NOTESDIR is ~/Notes"
|
||||||
|
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||||
|
echo " default notename is 'daily'"
|
||||||
|
echo " multi word notenames accepted without quotes."
|
||||||
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
$NOTEBIN/arbnote daily "$*"
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
if [ "${1-}" == "--help" ] || [ "${1-}" == "-h" ]; then
|
||||||
|
echo "usage: gnote [notename]"
|
||||||
|
echo " create a note in \$NOTESDIR/"
|
||||||
|
echo " default \$NOTESDIR is ~/Notes"
|
||||||
|
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||||
|
echo " default notename is 'global'"
|
||||||
|
echo " multi word notenames accepted without quotes."
|
||||||
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
$NOTEBIN/arbnote global "$*"
|
||||||
|
fi
|
||||||
|
|
20
mnote
20
mnote
|
@ -1,12 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
if [ "${1-}" == "--help" ] || [ "${1-}" == "-h" ]; then
|
||||||
NOTENAME="${1:-monthly}"
|
echo "usage: mnote [notename]"
|
||||||
DATEDIR="$NOTESDIR/$(date +%Y/%m)"
|
echo " create a monthly note in \$NOTESDIR/year/month"
|
||||||
mkdir -p "$DATEDIR"
|
echo " default \$NOTESDIR is ~/Notes"
|
||||||
NOTEPATH="$DATEDIR/$NOTENAME"
|
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||||
echo "$NOTEPATH"
|
echo " default notename is 'monthly'"
|
||||||
if ! [ -f "$NOTEPATH" ]; then
|
echo " multi word notenames accepted without quotes."
|
||||||
printf "$NOTENAME for $(date +%Y/%m)\n---\n\n" > "$NOTEPATH"
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
$NOTEBIN/arbnote monthly "$*"
|
||||||
fi
|
fi
|
||||||
$EDITOR "$NOTEPATH"
|
|
||||||
|
|
20
ynote
20
ynote
|
@ -1,12 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
if [ "${1-}" == "--help" ] || [ "${1-}" == "-h" ]; then
|
||||||
NOTENAME="${1:-yearly}"
|
echo "usage: ynote [notename]"
|
||||||
DATEDIR="$NOTESDIR/$(date +%Y)"
|
echo " create a yearly note in \$NOTESDIR/year"
|
||||||
mkdir -p "$DATEDIR"
|
echo " default \$NOTESDIR is ~/Notes"
|
||||||
NOTEPATH="$DATEDIR/$NOTENAME"
|
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||||
echo "$NOTEPATH"
|
echo " default notename is 'yearly'"
|
||||||
if ! [ -f "$NOTEPATH" ]; then
|
echo " multi word notenames accepted without quotes."
|
||||||
printf "$NOTENAME for $(date +%Y)\n---\n\n" > "$NOTEPATH"
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
$NOTEBIN/arbnote yearly "$*"
|
||||||
fi
|
fi
|
||||||
$EDITOR "$NOTEPATH"
|
|
||||||
|
|
Loading…
Reference in New Issue