git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/aux/git-checkers/.filelistgen-nonsysv
blob: a400beb790251d36dded25377ca002f26132392d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash

RETVAL=0
declare -x NCURSINST SCDIR GROOTDIR BASHLIST KORNLIST ECMALIST TIDYLIST
command -v tput >/dev/null 2>&1&&NCURSINST=1||NCURSINST=0
SCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# I AM G(IT)ROOT!
GROOTDIR="$(git rev-parse --show-toplevel)"||exit 1
BASHLIST="$GROOTDIR/aux/git-checkers/bashlist"
KORNLIST="$GROOTDIR/aux/git-checkers/kornlist"
POSHLIST="$GROOTDIR/aux/git-checkers/poshlist"
ECMALIST="$GROOTDIR/aux/git-checkers/ecmalist"
TIDYLIST="$GROOTDIR/aux/git-checkers/tidylist"
MAKELIST="$GROOTDIR/aux/git-checkers/makelist"

function initmimick {
	[ -z "$1" ]&&echo "crit_fail in initmimick(): no parameter passed" >&2&&exit 1
	[ -z "$2" ]&&echo "crit_fail in initmimick(): no string passed" >&2&&exit 2
        case "$1" in
		0)
			echo -en "\\033[999D";echo -en "\\033[K"
			case "$NCURSINST" in
				1)echo -en "[ $(tput setaf 2)$(tput bold)OK$(tput sgr0) ] $2.";;
				*)echo -en "[ OK ] $2.";;
			esac
			echo " $3"
		;;
		*)
			echo -en "\\033[999D";echo -en "\\033[K"
			case "$NCURSINST" in
				1)echo -en "[ $(tput setaf 1)$(tput bold)FAIL$(tput sgr0) ] $2:";;
				*)echo -en "[ FAIL ] $2:";;
			esac
			echo " $3"
		;;
	esac
}
STAGECMD="Generating Bash code list"
echo -n "[....] $STAGECMD"
if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep Bourne-Again|grep -vE "tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vcP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')")" -gt 0 ];then
	if [ -e "$GROOTDIR/.gitignore" ];then
		find "$GROOTDIR" -type f -exec file '{}' \;|grep Bourne-Again|grep -vE "tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')" > "$BASHLIST"
	else
		find "$GROOTDIR" -type f -exec file '{}' \;|grep Bourne-Again|grep -vE "tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"> "$BASHLIST"
	fi
else
	true>"$BASHLIST"
fi
CRETVAL="$?"
case "$CRETVAL" in
	0) initmimick 0 "$STAGECMD" "...$(wc -l "$BASHLIST"|awk '{print $1}') found";;
	*) initmimick 1 "$STAGECMD" "...$(wc -l "$BASHLIST"|awk '{print $1}') found";((++RETVAL));;
esac
STAGECMD="Generating KSH code list"
echo -n "[....] $STAGECMD"
if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep Korn\ shell|grep -vE "/tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vcP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')")" -gt 0 ];then
	if [ -e "$GROOTDIR/.gitignore" ];then
		find "$GROOTDIR" -type f -exec file '{}' \;|grep Korn\ shell|grep -vE "/tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')" > "$KORNLIST"
	else
		find "$GROOTDIR" -type f -exec file '{}' \;|grep Korn\ shell|grep -vE "/tmp/|aux/github-markdown"|sed "s|:.*||g;s|$GROOTDIR/||g" > "$KORNLIST"
	fi
else
	true>"$KORNLIST"
fi
CRETVAL="$?"
case "$CRETVAL" in
	0) initmimick 0 "$STAGECMD" "...$(wc -l "$KORNLIST"|awk '{print $1}') found";;
	*) initmimick 1 "$STAGECMD" "...$(wc -l "$KORNLIST"|awk '{print $1}') found";((++RETVAL));;
esac
STAGECMD="Generating POSIX shell code list"
echo -n "[....] $STAGECMD"
if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep POSIX\ shell|grep -vE "/tmp/|aux/github-markdown|\.git/"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vcP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')")" -gt 0 ];then
	if [ -e "$GROOTDIR/.gitignore" ];then
		find "$GROOTDIR" -type f -exec file '{}' \;|grep POSIX\ shell|grep -vE "/tmp/|aux/github-markdown|\.git/"|sed "s|:.*||g;s|$GROOTDIR/||g"|grep -vP "$(tr '\n' '|' < "$GROOTDIR/.gitignore"|sed 's/|$//g')" > "$POSHLIST"
	else
		find "$GROOTDIR" -type f -exec file '{}' \;|grep POSIX\ shell|grep -vE "/tmp/|aux/github-markdown|\.git/"|sed "s|:.*||g;s|$GROOTDIR/||g" > "$POSHLIST"
	fi
else
	true>"$POSHLIST"
fi
CRETVAL="$?"
case "$CRETVAL" in
	0) initmimick 0 "$STAGECMD" "...$(wc -l "$POSHLIST"|awk '{print $1}') found";;
	*) initmimick 1 "$STAGECMD" "...$(wc -l "$POSHLIST"|awk '{print $1}') found";((++RETVAL));;
esac
STAGECMD="Generating ECMA script list"
echo -n "[....] $STAGECMD"
if [ "$(find "$GROOTDIR" -type f -name "*.js"|sed "s|$GROOTDIR/||g"|grep -vcE "/tmp/")" -gt 0 ];then
	find "$GROOTDIR" -type f -name "*.js"|sed "s|$GROOTDIR/||g"|grep -vE "/tmp/" > "$ECMALIST" 2>/dev/null
else
	true>"$ECMALIST"
fi
CRETVAL="$?"
case "$CRETVAL" in
	0) initmimick 0 "$STAGECMD" "...$(wc -l "$ECMALIST"|awk '{print $1}') found";;
	*) initmimick 1 "$STAGECMD" "...$(wc -l "$ECMALIST"|awk '{print $1}') found";((++RETVAL));;
esac
STAGECMD="Generating PHP and HTML code list"
echo -n "[....] $STAGECMD"
if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep -E 'PHP script|HTML document'|sed "s|:.*||g;s|$GROOTDIR/||g"|wc -l)" -gt 0 ];then
	find "$GROOTDIR" -type f -exec file '{}' \;|grep -E 'PHP script|HTML document'|sed "s|:.*||g;s|$GROOTDIR/||g" > "$TIDYLIST" 2>/dev/null
else
	true>"$TIDYLIST"
fi
CRETVAL="$?"
case "$CRETVAL" in
	0) initmimick 0 "$STAGECMD" "...$(wc -l "$TIDYLIST"|awk '{print $1}') found";;
	*) initmimick 1 "$STAGECMD" "...$(wc -l "$TIDYLIST"|awk '{print $1}') found";((++RETVAL));;
esac
STAGECMD="Generating Makefile code list"
echo -n "[....] $STAGECMD"
if [ "$(find "$GROOTDIR" -type f -exec file '{}' \;|grep makefile\ script|sed "s|:.*||g;s|$GROOTDIR/||g"|wc -l)" -gt 0 ];then
	find "$GROOTDIR" -type f -exec file '{}' \;|grep makefile\ script|sed "s|:.*||g;s|$GROOTDIR/||g" > "$MAKELIST"
else
	true>"$MAKELIST"
fi
CRETVAL="$?"
case "$CRETVAL" in
	0) initmimick 0 "$STAGECMD" "...$(wc -l "$MAKELIST"|awk '{print $1}') found";;
	*) initmimick 1 "$STAGECMD" "...$(wc -l "$MAKELIST"|awk '{print $1}') found";((++RETVAL));;
esac
exit $RETVAL