#!/bin/sh
#This is a skeleton template for Velcoty by Kyle Davis

#VARIABLES:
#  var      - a normal variable, no special rules
#  booleans - empty string means a variable will be FALSE, anything else is considered TRUE
#  array    - a comma seperated list of items
#
version="1.0";	#var: version of your template
name="Script Name";	#var: name that will appear in Velocity
authors="Authors";	#array: authors list (eg. "joe,mary,fred")
about="Single line containing a short description of what this template does";	#var: short description
localonly="Yes";	#boolean:  If Velocity should ignore this template on non-local files
dependancies="basename,dirname,dep1,dep2";	#array:  list of programs you need for this template (leave basename and dirname)
mimetype="x-directory/normal";	#var: MIME-type for templated file (eg. "text/plain" or "text/x-perl")
defaultfilename="Some Filename.ext"	#var: 
#
#NOTE:  here is a snippet to read all arguments sequentially if you want to support multiple files
#See the audio conversion scripts in ($PREFIX/share/velocity/scripts/) for a full example
#  #!/bin/sh
#  while [ $# != 0 ]; do
#     echo "$1"
#     shift
#  done
case $1 in
	--get-info)
		#DO NOT CHANGE THIS LINE, THIS IS THE VELOCITY TEMPLATE CONFIG FORMAT
		echo -en "$version\n$name\n$authors\n$about\n$localonly\n$mimetype\n$dependancies\n$defaultfilename"
		;;
	--execute|--overide-desired)
		this=$0
		if [ "$1" == "--overide-desired" ]; then
			#if so everything our defaultfilename gets changed
			shift;defaultfilename=$1
		fi
		shift;location=$1
		#start dependancies
		shift;dbasename=$1
		shift;ddirname=$1
		shift;dep3=$1
		#end dependancies

		templatesdir=`$ddirname $this`
		datadir="$templatesdir/data"
		datafile=`$dbasename $this`
		cp "$datadir/$datafile" "$location$defaultfilename"
		chmod a+x "$location$defaultfilename"
		"$dep3" "$location$defaultfilename" &
		;;
	*)
		echo "This should only be used by Velocity."
		;;
esac
