#!/bin/sh
#word-document:  an example template for Velocity by Kyle Davis
#NOTE:  we use echo -en for things that go to Velocity to avoid a blank line in our context menus

version="1.0";
name="HTML Document";
authors="Kyle Davis";
about="This is a demo template for Velocity.";
localonly="Yes";
dependancies="mozilla|gnp|gedit,basename,dirname,grep";
mimetype="text/html";
defaultfilename="New HTML Document.html";
case $1 in
	--get-info)
		echo -en "$version\n$name\n$authors\n$about\n$localonly\n$mimetype\n$dependancies\n$defaultfilename"
		;;
	--execute|--overide-desired)
		if [ "$1" == "--overide-desired" ]; then
			#if so everything our variables are off by one, and defaultfilename gets changed
			defaultfilename=$2
			location=$3
			dep1=$4
			dep2=$5
			dep3=$6
		else
			location=$2
			dep1=$3
			dep2=$4
			dep3=$5
		fi
		templatesdir=`$dep3 $0`
		datadir="$templatesdir/data"
		datafile=`$dep2 $0`
		cp "$datadir/$datafile" "$location/$defaultfilename"
		if [ "`echo $dep1|grep mozilla`" ]; then
			"$dep1" --edit "$location$defaultfilename" &
		else
			"$dep1" "$location$defaultfilename" &
		fi
		;;
	*)
		echo "This should only be used by Velocity."
		;;
esac
