dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit 11803e667f4d5ac218368f51cefa1f3361675d20
parent 2532a4ef46003b9c537474133f12db3cc6619855
Author: Duncaen <mail@duncano.de>
Date:   Thu, 16 Feb 2017 01:31:34 +0100

bin: add jour

Diffstat:
bin/jour | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/bin/jour b/bin/jour @@ -0,0 +1,18 @@ +#!/bin/sh +# jour [-d YYYY.MM.DD] [ls|read|write] - simple text journal + +: ${JOURNAL_DIR:=~/journal} +: ${DAY:=$(date +%Y.%m.%d)} +[ -d "${JOURNAL_DIR}" ] || mkdir -p "${JOURNAL_DIR}" +while getopts "d:" opt; do + case "$opt" in + d) DAY=$OPTARG ;; + esac +done +shift $((OPTIND-1)) +case "${1:-write}" in +l|ls) ls -1 "${JOURNAL_DIR}" ;; +r|read) ${PAGER:-more} "${JOURNAL_DIR}/${DAY}" ;; +w|write) ${EDITOR:-vi} "${JOURNAL_DIR}/${DAY}" ;; +*) false ;; +esac