This repository was archived by the owner on Aug 29, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed
Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash -eu
22
33function usage() {
4- echo " vendor -l|-v <Package URL>"
5- echo " -l List packages that may need to be vendored"
4+ echo " vendor -l|-v <Package URL>|-u <Package URL>|-c "
5+ echo " -l list packages that may need to be vendored"
66 echo " -v vendor a package"
77 echo " -u update a vendored package"
8+ echo " -c clean vendored dependencies"
89 exit 1
910}
1011
1112list=false
1213vendor=false
1314update=false
15+ clean=false
16+ count=0
1417
15- while getopts " lvu " o; do
18+ while getopts " lvuc " o; do
1619 case " ${o} " in
17- l) list=true;;
18- v) vendor=true;;
19- u) update=true;;
20+ l) list=true; count=$(( count+ 1 )) ;;
21+ v) vendor=true; count=$(( count+ 1 )) ;;
22+ u) update=true; count=$(( count+ 1 )) ;;
23+ c) clean=true; count=$(( count+ 1 )) ;;
2024 * ) usage;;
2125 esac
2226done
2327
24- if $list && [ " $vendor " -o " $update " ]; then
25- usage
26- exit
27- fi
28-
29- if ! $list && ! $vendor && ! $update ; then
28+ if [ " $count " -ne " 1" ]; then
3029 usage
3130 exit
3231fi
@@ -69,9 +68,12 @@ if $list; then
6968 popd > /dev/null
7069
7170 rm -rf /tmp/vendor_pkg_list
72- fi
73-
74- if [[ $vendor || $update ]]; then
71+ elif $clean ; then
72+ echo " Cleaning vendored dependencies"
73+ for dot_a in ` find vendor/ -name * .a | cut -c 8-` ; do
74+ rm -f vendor/$dot_a $ORIG_GOPATH /$dot_a
75+ done
76+ elif [[ $vendor || $update ]]; then
7577 pkg=$2
7678
7779 if [ " x${pkg} x" == " xx" ]; then
You can’t perform that action at this time.
0 commit comments