#!/bin/bash
########################################################################
#  Copyright (c) amitego engineering GmbH, www.amitego.com
########################################################################
# extend the tarantella sub commands


TTAENS=$TTAINSTDIR/var/ens
#set -x

die () 
{
	>&2 echo $*
	exit -1
}
###########################################
convert ()
{
  local partList=$(echo $1 | tr "/" "\n")
  local object64=$TTAENS

  IFS="
"
  for part in $partList
  do
	part64=$(echo -n "$part" | base64)
	object64="$object64/$part64"
  done
  echo $object64
}


USAGE="You must name an object, using --name.
Usage: tarantella object exists --name <obj> 
"

[[ $1 == "--name" ]] || die $USAGE
[[ $2 == "" ]]       && die $USAGE
object=$(echo $2 | tr [:upper:] [:lower:])

###########################################
object64=$(convert "$object")

exit $(test -d $object64)


