-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcup
More file actions
executable file
·41 lines (35 loc) · 1011 Bytes
/
Copy pathbcup
File metadata and controls
executable file
·41 lines (35 loc) · 1011 Bytes
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
#!/usr/bin/env bash
# bcup - update bash_common
#
# Pulls the latest bash_common from git. Optionally re-downloads bundled
# completion scripts from their upstream sources.
#
# Usage: bcup [-u] [-h]
# -u update bundled completion scripts (git completion etc.)
# -h show this help
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
usage() {
echo "Usage: $(basename $0) [-u] [-h]"
echo " -u update bundled completion scripts"
echo " -h show this help"
}
while getopts "uh" OPT; do
case "${OPT}" in
u) DO_UPDATE=1 ;;
h) usage; exit 0 ;;
*) usage; exit 1 ;;
esac
done
echo "Get latest"
pushd $BC_INSTALL_DIR
git pull
popd
if [ -n "$DO_UPDATE" ]; then
if ! command_exists wget; then
echo "Error: wget not installed. Run bcinit to install dependencies." >&2
exit 1
fi
pushd $BC_INSTALL_DIR/completion
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O git.completion.bash
popd
fi