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

_help(){
	echo -e "$(bs-ng-parse-echo $white)Usage:\
	\n$(bs-ng-parse-echo $orange)fdnl$(bs-ng-parse-echo $white) | $(bs-ng-parse-echo $green)+h $(bs-ng-parse-echo $iceblue)[count files and folders - include hidden ones] \
	\n$(bs-ng-parse-echo $orange)fdnl$(bs-ng-parse-echo $white) | $(bs-ng-parse-echo $green)-h $(bs-ng-parse-echo $iceblue)[count files and folders - exclude hidden ones] \
	\n$(bs-ng-parse-echo $orange)fdnl$(bs-ng-parse-echo $white) | $(bs-ng-parse-echo $green)+d $(bs-ng-parse-echo $iceblue)[count folders - include hidden ones] \
	\n$(bs-ng-parse-echo $orange)fdnl$(bs-ng-parse-echo $white) | $(bs-ng-parse-echo $green)-d $(bs-ng-parse-echo $iceblue)[count folders - exclude hidden ones] \
	\n$(bs-ng-parse-echo $orange)fdnl$(bs-ng-parse-echo $white) | $(bs-ng-parse-echo $green)+f $(bs-ng-parse-echo $iceblue)[count files - include hidden ones] \
	\n$(bs-ng-parse-echo $orange)fdnl$(bs-ng-parse-echo $white) | $(bs-ng-parse-echo $green)-f $(bs-ng-parse-echo $iceblue)[count files - exclude hidden ones]"
}

case $1 in
	*+h)
		echo $(($(ls --color=no -1 -la . | grep -v ^l | wc -l)-3))
	;;

	*-h)
		echo $(($(ls --color=no -1 -l . | grep -v ^l | wc -l)-1))
	;;
	
	*-d)
		echo $(($(ls --color=no -1 -l . | grep -v ^- | wc -l)-1))
	;;
	
	*-f)
		echo $(($(ls --color=no -1 -l . | grep -v ^d | wc -l)-1))
	;;
	
	*+d)
		echo $(($(ls --color=no -1 -la . | grep -v ^- | wc -l)-3))
	;;
	
	*+f)
		echo $(($(ls --color=no -1 -la . | grep -v ^d | wc -l)-3))
	;;

	*)
		_help
		tput sgr0
	;;
esac
