#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG 6.8				#
#							#
# Licensed under GNU LESSER GENERAL PUBLIC LICENSE v3	#
#							#
# Copyright 2007 - 2008 Christopher Bratusek		#
#							#
#########################################################

export pwdmaxlen=$(gconftool-2 --get /apps/bashstyle/pwdmaxlen)

export trunc_symbol=$(gconftool-2 --get /apps/bashstyle/pwdchar)

export dirchar=$(gconftool-2 --get /apps/bashstyle/dirchar)

export newsepacolor=$(bs-ng-parse-echo $sepacolor)

export newwdircolor=$(bs-ng-parse-echo $wdircolor)

export newpscolor=$(bs-ng-parse-echo $pscol)

if [[ $pstyle == separator || $pstyle == dirks || $pstyle == dot_prompt || $pstyle == sputnik ]]; then
	export supported=yes
fi

if [[ $enabcol == true && $supported == yes ]]; then

	if [ ${#PWD} -gt $pwdmaxlen ]; then
		export pwdoffset=$(( ${#PWD} - $pwdmaxlen ))
		export xPWD="$newpscolor${trunc_symbol}${PWD:$pwdoffset:$pwdmaxlen}"
		export newPWD="${xPWD//\//$newsepacolor$dirchar$newwdircolor}"
	else
		export newPWD="${PWD//\//$newsepacolor$dirchar$newwdircolor}"
	fi

else

	if [ ${#PWD} -gt $pwdmaxlen ]; then
		export pwdoffset=$(( ${#PWD} - $pwdmaxlen ))
		export xPWD="${trunc_symbol}${PWD:$pwdoffset:$pwdmaxlen}"
		export newPWD="${xPWD//\//$dirchar}"
	else
		export newPWD="${PWD//\//$dirchar}"
	fi

fi

echo -e $newPWD
