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

if [[ $(get_key shopt/cdspell) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"cdspell" $"On"
	dbg_log shopt -s cdspell
else	dbg_msg $"BashStyle-NG Setting:" $"cdspell" $"Off"
	dbg_log shopt -u cdspell
fi

if [[ $(get_key shopt/cdable_vars) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"cdable_vars" $"On"
	dbg_log shopt -s cdable_vars
else	dbg_msg $"BashStyle-NG Setting:" $"cdable_vars" $"Off"
	dbg_log shopt -u cdable_vars
fi

if [[ $(get_key shopt/checkhash) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"checkhash" $"On"
	dbg_log shopt -s checkhash
else	dbg_msg $"BashStyle-NG Setting:" $"checkhash" $"Off"
	dbg_log shopt -u checkhash
fi

if [[ $(get_key shopt/cmdhist) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"cmdhist" $"On"
	dbg_log shopt -s cmdhist
else	dbg_msg $"BashStyle-NG Setting:" $"cmdhist" $"Off"
	dbg_log shopt -u cmdhist
fi

if [[ $(get_key shopt/force_fignore) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"force_fignore" $"On"
	dbg_log shopt -s force_fignore
else	dbg_msg $"BashStyle-NG Setting:" $"force_fignore" $"Off"
	dbg_log shopt -u force_fignore
fi

if [[ $(get_key shopt/histreedit) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"histreedit" $"On"
	dbg_log shopt -s histreedit
else	dbg_msg $"BashStyle-NG Setting:" $"histreedit" $"Off"
	dbg_log shopt -u histreedit
fi

if [[ $(get_key shopt/no_empty_cmd_completion) == true ]]; then \
	dbg_msg $"BashStyle-NG Setting:" $"no_empty_cmd_completion" $"On"
	dbg_log shopt -s no_empty_cmd_completion
else	dbg_msg $"BashStyle-NG Setting:" $"no_empty_cmd_completion" $"Off"
	dbg_log shopt -u no_empty_cmd_completion
fi

if [[ $HISTCONTROL != erasedups && $(get_key shopt/histappend) == true ]]; then
	dbg_msg $"BashStyle-NG Setting:" $"histappend" $"On"
	dbg_log shopt -s histappend
else	dbg_msg $"BashStyle-NG Setting:" $"histappend" $"Off"
	dbg_log shopt -u histappend
fi

if [[ ${BASH_VERSINFO[0]} -ge "4" ]]; then

	if [[ $(get_key shopt/autocd) == true ]]; then
		dbg_msg $"BashStyle-NG Setting:" $"autocd" $"On"
		dbg_log shopt -s autocd
	else	dbg_msg $"BashStyle-NG Setting:" $"autocd" $"Off"
		dbg_log shopt -u autocd
	fi

	if [[ $(get_key shopt/checkjobs) == true ]]; then
		dbg_msg $"BashStyle-NG Setting:" $"checkjobs" $"On"
		dbg_log shopt -s checkjobs
	else	dbg_msg $"BashStyle-NG Setting:" $"checkjobs" $"Off"
		dbg_log shopt -u checkjobs
	fi

	if [[ $(get_key shopt/globstar) == true ]]; then
		dbg_msg $"BashStyle-NG Setting:" $"globstar" $"On"
		dbg_log shopt -s globstar
	else	dbg_msg $"BashStyle-NG Setting:" $"globstar" $"Off"
		dbg_log shopt -u globstar
	fi

	if [[ $(get_key shopt/dirspell) == true ]]; then
		dbg_msg $"BashStyle-NG Setting:" $"dirspell" $"On"
		dbg_log shopt -s dirspell
	else	dbg_msg $"BashStyle-NG Setting:" $"dirspell" $"Off"
		dbg_log shopt -u dirspell
	fi
else	dbg_msg $"BashStyle-NG Message: Bash is not 4.x -- disabling new shopts"

fi
