#!/bin/zsh -f
# shell script name  forklift

# Open ForkLift in specified directory or in $PWD

version="0.0.1"


###############################################################################
 
#  Created by  on .
#  Copyright (c) . All rights reserved.


#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
#    USA
#    
#    cf. URL:   http://www.fsf.org/licensing/licenses/gpl.html
#
###############################################################################

if [[ -f  $HOME/Library/Preferences/com.binarynights.ForkLift.plist  ]]; then

	if [[ -d "$1" ]];then
		DIRECTORYNAME="$1"
	elif [[ "$1" == "-f" || "$1" == "-F"  ]];then
	    autoload -U posd
		DIRECTORYNAME="$(posd)"	   
	else
		DIRECTORYNAME="$PWD"
	fi

    /usr/bin/open -a ForkLift $DIRECTORYNAME

        DIRECTORYNAME=""


else
	print "This function is designed to work with ForkLift, which does not appear to be installed."
fi

