#!/bin/bash

#
# appify.sh
#


APP=$(which $1);
APPNAME=$(echo $1 | perl -p -e 's/(\w)(\w*)/\u$1\L$2/g' );
DIR="/Applications/$APPNAME.app/Contents/MacOS"
if [ -a "/Applications/$APPNAME.app" ]; then
  echo "First remove /Applications/$APPNAME.app";
  exit 1
fi
mkdir -p "$DIR"
echo -e "#!/bin/bash\n\n$APP" > "$DIR/$APPNAME"
chmod +x "$DIR/$APPNAME"
IMG=/opt/local/share/icons/hicolor/256x256/apps/$APP.png
if [ -f $IMG ] ; then
	echo $IMG
fi
exit 0;
