#!/usr/pkg/bin/bash

filename="$(date +%Y.%m.%d)"
filepath="$HOME/gopher/phlog/"

nano "$filepath$filename"

function make_entry(){
	oldpath="$(pwd)"
	cd "$filepath";
	/sys/sdf/bin/mkgopherentry "$title" "$filename";
	cd "$oldpath";
}

title="$(echo -n "Enter a title: ">&2; read title; echo "$title";)"

echo "Making entry \"$filename\" with title \"$title\"..."

make_entry