dotfiles

config files for my linux setup
git clone git://edryd.org/dotfiles
Log | Files | Refs | README

pub (384B)


      1 #!/usr/bin/env bash
      2 
      3 # pub: prepare post to be published
      4 #
      5 # Moves given draft into the posts directory and prefixes the filename with the
      6 # date so that it is ready to be published.
      7 
      8 if [[ $# == 0 || $# > 2 || ! -f "$1" ]]; then
      9   echo "usage: pub FILE [POSTDIR]"
     10   exit 1
     11 fi
     12 
     13 date=$(date +"%Y-%m-%d")
     14 file=$(basename "$1")
     15 postsdir=${2:-_posts}
     16 
     17 mv "$1" "$postsdir"/"$date"-"$file"