Skip to content

Commit a4f1db7

Browse files
committed
various modifications on plugins and the interfaces to produce better output
1 parent 9218b3a commit a4f1db7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+139
-118
lines changed

bash-it/beamery/plugins/audit_git_branches.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ source "${HOME}/.bash_it/plugins/available/beamery/pluginsInterface.bash"
88
# This is useful to identify dead branches
99

1010
audit_git_branches() {
11-
execute -g $@ "echo ""; git branch -vv";
11+
execute -g $@ "echo ""; git branch -vv; echo ''";
1212

1313
printf "${YELLOW}\nHistorical Branches Data:\n${NC}";
14-
execute -g $@ "echo""; git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/remotes"
14+
execute -g $@ "echo ""; git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/remotes; echo "";"
1515
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# Load the main plugins "interface"
4+
source "${HOME}/.bash_it/plugins/available/beamery/pluginsInterface.bash"
5+
6+
# check_node_package_usage
7+
# Check the places a certain npm package is used across all the repos
8+
9+
check_node_package_usage() {
10+
11+
execute -n "grep -sw $1 ./package.json >/dev/null && printf '\e[1A\e[40C' && grep -sw '\"$1\":' ./package.json || printf '\e[1A\e[K'"
12+
13+
}

bash-it/beamery/plugins/check_npm_usage.bash

Lines changed: 0 additions & 14 deletions
This file was deleted.

bash-it/beamery/plugins/clean_git_local_branches.bash

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ source "${HOME}/.bash_it/plugins/available/beamery/pluginsInterface.bash"
88

99
clean_git_local_branches() {
1010

11-
1211
# Check if gawk is installed which is not by default in mac systems
1312
if ! type gawk &> /dev/null ; then
1413
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -17,9 +16,7 @@ clean_git_local_branches() {
1716
fi
1817
fi
1918

20-
execute -g $@ "echo""; git fetch --all";
21-
execute -g $@ "echo""; git remote prune origin"
22-
execute -g $@ "echo""; git gc --prune=now"
19+
execute -g $@ "echo""; git fetch --all && git remote prune origin && git gc --prune=now; echo''";
2320

2421
if [[ `git branch -vv | grep ': gone]'` ]]; then
2522
printf "\n${YELLOW}Making sure that all 'gone' branches are also removed ..\n\n${NC}"

bash-it/beamery/plugins/clean_git_remote_branches.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ source "${HOME}/.bash_it/plugins/available/beamery/pluginsInterface.bash"
77
# Clean remote branches that have been merged into master and delete them from remotes as well
88

99
clean_git_remote_branches() {
10-
execute -g $@ "echo""; git branch -r --merged | egrep -v '(^\*|master|development)' | sed 's/origin\///g'| xargs -n 1 git push --delete origin"
10+
execute -g $@ "echo""; git branch -r --merged | egrep -v '(^\*|master|development)' | sed 's/origin\///g'| xargs -n 1 git push --delete origin; echo ''"
1111
}

bash-it/beamery/plugins/clean_git_stash.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ clean_git_stash() {
1212
read -p "Are you sure you want to proceed ? [Y/N] " -n 1;
1313

1414
if [[ $REPLY =~ ^[Yy]$ ]]; then
15-
execute -g $@ "git stash clear && echo '--> done'"
15+
execute -g $@ "echo ''; git stash clear && echo '--> done'"
1616
fi
1717
echo "";
1818
}

bash-it/beamery/plugins/generate_npm_report.bash

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,27 @@ source "${HOME}/.bash_it/plugins/available/beamery/pluginsInterface.bash"
1010

1111
generate_npm_report() {
1212

13+
check_npm_report() {
14+
if [[ -f "npm-report.txt" ]]; then
15+
read -p "We have detected that an npm-report already exists. Would you like to clear that out before ? [Y/N] " -n 1;
16+
if [[ $REPLY =~ ^[Yy]$ ]]; then
17+
rm -rf "npm-report.txt"
18+
echo ""
19+
fi;
20+
fi;
21+
}
22+
1323
if [[ $@ == *'-s'* ]]; then
1424
echo "This function is not designed to work in single folder mode .. please revert to good old fashioned commands"
1525
else
1626
if command_exists npm-check ; then
17-
execute -n "npm-check >> ../npm-report.txt"
27+
check_npm_report
28+
execute -n 'echo "Checking NPM modules in package.json"; echo [REPOSITORY] `basename $PWD` >> ../npm-report.txt; npm-check >> ../npm-report.txt'
1829
else
1930
printf 'npm-check module was not found. Installing now:';
2031
npm install -g npm-check
21-
execute -n "npm-check >> ../npm-report.txt"
32+
check_npm_report
33+
execute -n 'echo "Checking NPM modules in package.json"; echo [REPOSITORY] `basename $PWD` >> ../npm-report.txt; npm-check >> ../npm-report.txt'
2234
fi
2335
fi;
2436
}

bash-it/beamery/plugins/list_git_active_branch.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ source "${HOME}/.bash_it/plugins/available/beamery/pluginsInterface.bash"
88
# This is useful to know which branches are flipped on which repos
99

1010
list_git_active_branch() {
11-
execute -g $@ printf "'${YELLOW}' && git branch | grep '^\*' | cut -d' ' -f2 && printf '${NC}'"
11+
execute -g $@ printf "'\e[1A\e[70CBranch: ${YELLOW}' && git branch | grep '^\*' | cut -d' ' -f2 && printf '${NC}'"
1212
}

bash-it/beamery/plugins/switch_git_branch.bash

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ switch_git_branch() {
2121
if [[ $REPLY =~ ^[Yy]$ ]]; then
2222
if ! [[ $BRANCH =~ ^(master|development)$ ]]; then
2323
printf "\nYou are switching to a non-default branch ... fetching first\n"
24-
execute -g "git fetch; git stash; git checkout $BRANCH"
24+
execute -g "echo''; git fetch; git stash; git checkout $BRANCH; echo''"
2525
else
26-
execute -g "git stash; git checkout $BRANCH"
26+
execute -g "echo''; git stash; git checkout $BRANCH; echo''"
2727
fi
2828
fi;
29-
echo "";
3029
fi;
3130
}

bash-it/beamery/plugins/switch_git_branch_and_update.bash

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ switch_git_branch_and_update() {
2828
printf "\nYou are switching to a non-default branch ... will fetch repositories first\n"
2929
# Since this function already accepts params passed
3030
# We need to check if any of the params passed is the -s which indicates this should run on a single folder
31-
execute -g "git fetch; git stash; git checkout $BRANCH; git pull $REMOTE $BRANCH"
31+
execute -g "echo ''; git fetch; git stash; git checkout $BRANCH; git pull $REMOTE $BRANCH; echo ''"
3232
else
33-
execute -g "git stash; git checkout $BRANCH; git pull $REMOTE $BRANCH"
33+
execute -g "echo ''; git stash; git checkout $BRANCH; git pull $REMOTE $BRANCH; echo''"
3434
fi
3535
fi;
36-
echo "";
3736
fi;
38-
3937
}

0 commit comments

Comments
 (0)