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
|
||||
set -euo pipefail
|
||||
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
||||
NOTENAME="${1:-monthly}"
|
||||
DATEDIR="$NOTESDIR/$(date +%Y/%m)"
|
||||
mkdir -p "$DATEDIR"
|
||||
NOTEPATH="$DATEDIR/$NOTENAME"
|
||||
echo "$NOTEPATH"
|
||||
if ! [ -f "$NOTEPATH" ]; then
|
||||
printf "$NOTENAME for $(date +%Y/%m)\n---\n\n" > "$NOTEPATH"
|
||||
if [ "${1-}" == "--help" ] || [ "${1-}" == "-h" ]; then
|
||||
echo "usage: mnote [notename]"
|
||||
echo " create a monthly note in \$NOTESDIR/year/month"
|
||||
echo " default \$NOTESDIR is ~/Notes"
|
||||
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||
echo " default notename is 'monthly'"
|
||||
echo " multi word notenames accepted without quotes."
|
||||
else
|
||||
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
$NOTEBIN/arbnote monthly "$*"
|
||||
fi
|
||||
$EDITOR "$NOTEPATH"
|
||||
|
||||
|
|
20
ynote
20
ynote
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
||||
NOTENAME="${1:-yearly}"
|
||||
DATEDIR="$NOTESDIR/$(date +%Y)"
|
||||
mkdir -p "$DATEDIR"
|
||||
NOTEPATH="$DATEDIR/$NOTENAME"
|
||||
echo "$NOTEPATH"
|
||||
if ! [ -f "$NOTEPATH" ]; then
|
||||
printf "$NOTENAME for $(date +%Y)\n---\n\n" > "$NOTEPATH"
|
||||
if [ "${1-}" == "--help" ] || [ "${1-}" == "-h" ]; then
|
||||
echo "usage: ynote [notename]"
|
||||
echo " create a yearly note in \$NOTESDIR/year"
|
||||
echo " default \$NOTESDIR is ~/Notes"
|
||||
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||
echo " default notename is 'yearly'"
|
||||
echo " multi word notenames accepted without quotes."
|
||||
else
|
||||
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
$NOTEBIN/arbnote yearly "$*"
|
||||
fi
|
||||
$EDITOR "$NOTEPATH"
|
||||
|
||||
|
|
Loading…
Reference in New Issue