#!/bin/bash
#
# Quick and dirty P4V custom tool to view file content in Swarm
baseSwarmUrl=http://swarm.workshop.perforce.com
numOfArgs=$#
ellipses='...'
i=1
for i in $*
do
file=`echo $i | awk '{print substr($1, 2); }'`
last3chars=`echo $file | awk '{print substr($1, length($1)-2, length($1)); }'`
# Check to see if selection in p4v is a directory
if [ $last3chars == $ellipses ]
then
file=`echo $file | awk '{print substr($1, 1, length($1)-3); }'`
fi
urls=$urls' '$baseSwarmUrl$file
done
/usr/bin/firefox $urls