Delegate even more
This commit is contained in:
parent
fee04030e6
commit
d11ecda8ba
37
arbnote
37
arbnote
|
@ -1,37 +0,0 @@
|
|||
#!/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"
|
13
dnote
13
dnote
|
@ -1,14 +1,11 @@
|
|||
#!/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."
|
||||
if [ -f "$(which nnote)" ]; then
|
||||
NNOTE="$(which nnote)"
|
||||
else
|
||||
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
$NOTEBIN/arbnote daily "$*"
|
||||
NNOTE="$NOTEBIN/nnote"
|
||||
fi
|
||||
|
||||
$NNOTE daily "$*"
|
||||
|
||||
|
|
13
gnote
13
gnote
|
@ -1,14 +1,11 @@
|
|||
#!/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."
|
||||
if [ -f "$(which nnote)" ]; then
|
||||
NNOTE="$(which nnote)"
|
||||
else
|
||||
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
$NOTEBIN/arbnote global "$*"
|
||||
NNOTE="$NOTEBIN/nnote"
|
||||
fi
|
||||
|
||||
$NNOTE global "$*"
|
||||
|
||||
|
|
13
mnote
13
mnote
|
@ -1,14 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
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."
|
||||
if [ -f "$(which nnote)" ]; then
|
||||
NNOTE="$(which nnote)"
|
||||
else
|
||||
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
$NOTEBIN/arbnote monthly "$*"
|
||||
NNOTE="$NOTEBIN/nnote"
|
||||
fi
|
||||
|
||||
$NNOTE monthly "$*"
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#!/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: nnote <type> [notename]"
|
||||
echo " create or edit a note"
|
||||
echo " nnote <type> --help | -h"
|
||||
echo " get help for a note type"
|
||||
echo " "
|
||||
echo "nnote requires a type: daily, monthly, yearly, or global"
|
||||
echo "if not provided, type is used for notename, too"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${2-}" == "--help" ] || [ "${2-}" == "-h" ]; then
|
||||
echo "usage: nnote $NOTETYPE [notename]"
|
||||
echo " create a $NOTETYPE note in \$NOTESDIR/$DATESTRING"
|
||||
echo " default \$NOTESDIR is ~/Notes"
|
||||
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||
echo " default notename is '$NOTETYPE'"
|
||||
echo " multi word notenames accepted without quotes."
|
||||
else
|
||||
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
|
||||
pushd "$NOTESDIR" > /dev/null
|
||||
$EDITOR "$NOTEPATH"
|
||||
popd > /dev/null
|
||||
fi
|
13
ynote
13
ynote
|
@ -1,14 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
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."
|
||||
if [ -f "$(which nnote)" ]; then
|
||||
NNOTE="$(which nnote)"
|
||||
else
|
||||
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||
$NOTEBIN/arbnote yearly "$*"
|
||||
NNOTE="$NOTEBIN/nnote"
|
||||
fi
|
||||
|
||||
$NNOTE yearly "$*"
|
||||
|
||||
|
|
Loading…
Reference in New Issue