-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcppsm
More file actions
executable file
·52 lines (35 loc) · 1 KB
/
cppsm
File metadata and controls
executable file
·52 lines (35 loc) · 1 KB
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 -e
# shellcheck source=../commands/.settings
. "${BASH_SOURCE%/*/*}/commands/.settings"
COMMAND="$CPPSM/commands/$1"
if [ $# -ge 1 ] && [ -x "$COMMAND" ]; then
shift
exec "$COMMAND" "$@"
fi
if [ "$UPGRADE" = 1 ]; then
echo "Upgrading cppsm..."
exec git -C "$CPPSM" pull "${GIT_QUIET[@]}" --rebase
fi
# shellcheck disable=SC2035
COMMANDS="$(cd "$CPPSM/commands" && echo *)"
COMMANDS="${COMMANDS// /|}"
BRANCH="$(git -C "$CPPSM" symbolic-ref --short HEAD)"
cat << EOF
Usage: ${0##*/} [$COMMANDS]
Run any command with --help to see a brief description of the command.
Visit https://cppsm.github.io/ for full documentation.
Branch: $BRANCH
$(git -C "$CPPSM" log -n 5 --pretty=oneline --abbrev-commit | sed 's#^# #g')
EOF
git -C "$CPPSM" fetch "${GIT_QUIET[@]}" origin "$BRANCH"
ORIGIN="$(git -C "$CPPSM" log --pretty=oneline --abbrev-commit "..origin/$BRANCH" | sed 's#^# #g')"
if [ -n "$ORIGIN" ]; then
cat << EOF
Origin:
$ORIGIN
Run
UPGRADE=1 ${0##*/}
to upgrade cppsm.
EOF
fi
exit 1