-
Notifications
You must be signed in to change notification settings - Fork 1
/
bowerls
executable file
·52 lines (42 loc) · 1.08 KB
/
bowerls
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
#!/bin/bash
source $(dirname $0)/import_colors
BOWER_PATH=./bower_components
function fn_gitinfo {
local DIR=$1
pushd $DIR > /dev/null
if [ -d .git ]
then
git -c color.ui=always branch \
| grep -e "^* " \
| sed -e "s/^* /${COLOR_FG_GRAY}branch:${COLOR_RESET} /g"
git -c color.ui=always status -s
git -c color.ui=always log --graph --oneline --color --decorate | head -n 3
fi
popd > /dev/null
}
function fn_main {
if [ ! -d $BOWER_PATH ]
then
echo "${COLOR_FG_RED}'${BOWER_PATH}' not found.${COLOR_RESET}"
return 1
fi
for name in $(ls $BOWER_PATH)
do
local ITEM_PATH=$BOWER_PATH/$name
if [ -h $ITEM_PATH ]
then
local LINK_DESTINATION=$ITEM_PATH
while [ -h $LINK_DESTINATION ]
do
LINK_DESTINATION=$(readlink $LINK_DESTINATION)
done
echo "${COLOR_FG_MAGENTA}${name}${COLOR_RESET} -> ${LINK_DESTINATION}"
fn_gitinfo $ITEM_PATH | sed -e "s/^/ /g"
elif [ -d $ITEM_PATH ]
then
echo "${COLOR_FG_BLUE}${name}${COLOR_RESET}"
fi
done
return 0
}
fn_main