]> apps.delaporte.us Git - minion.git/blob - bin/mp
Add backup of wiki page
[minion.git] / bin / mp
1 #!/bin/bash
2 # mp - minion print
3 # Like `ml / minion list`, but gets the markdown file ready to print
4 # Will act on a maximum of four files.
5 # Creates .md.html files.
6 # Opends files in your $BROWSER or assumes firefox
7 year=`date +%Y`
8 files=$(find $HOME/Journal/$year -type f -iname "*$1*\.md")
9
10 if [ -z ${BROWSER} ]; then
11 echo "BROWSER unset, defaulting to Firefox"
12 export BROWSER=firefox
13 fi
14
15 counter=0
16 for file in $files; do
17 # echo $file
18 mdtohtml $file $file.html
19 $BROWSER $file.html &
20 counter=$((counter + 1))
21 if [ $counter -gt 4 ]; then
22 echo "Aborting after 4 files."
23 echo "The following files would have been processed..."
24 echo $files
25 exit 1
26 fi
27 done