X-Git-Url: https://git.xandkar.net/?p=khome.git;a=blobdiff_plain;f=home%2Fbin%2Fdraft;h=d9f2c4061f47f416803916d82e8f18e516b6e793;hp=de7b6e42583f1dfd433386020a1fe82aff2a1574;hb=2200de00bf85d0999f4af6f1535d97c6205ed2d8;hpb=ab32f98a2226acf25dfa0288468a23070f1877ca diff --git a/home/bin/draft b/home/bin/draft index de7b6e4..d9f2c40 100755 --- a/home/bin/draft +++ b/home/bin/draft @@ -2,6 +2,8 @@ set -euo pipefail +DEFAULT_BASE="$HOME/doc/drafts/adhoc" + bar() { local -r len="${1:-80}" # 1st arg or 80. local -r char="${2:--}" # 2nd arg or a dash. @@ -10,10 +12,11 @@ bar() { } main() { + local -r base="${1:-$DEFAULT_BASE}" + local -r title_given='Untitled' local -r title_lower=$(echo "$title_given" | tr '[:upper:]' '[:lower:]') local -r title_lower_dashed=$(echo "$title_lower" | sed 's/\s\+/-/g') - local -r base="${HOME}/doc/drafts/adhoc" local -r timestamp="$(date --iso-8601=ns)" local -r file="${base}/${timestamp}--${title_lower_dashed}.md"