-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdco.sh
More file actions
executable file
·73 lines (67 loc) · 2.04 KB
/
dco.sh
File metadata and controls
executable file
·73 lines (67 loc) · 2.04 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
#
# DCO CLI Entry Point
# ====================
# Routes subcommands to the appropriate script.
#
# dco commit [--signing-key <path>] [--yes] <git commit arguments>
# dco validate [--verbose] [--enforce-signature-fingerprints]
#
set -e
function _resolveSelfDir {
local SOURCE="$1"
local DIR=""
if [[ $SOURCE != /* ]]; then
SOURCE="$(cd "$(dirname "$SOURCE")" && pwd)/$(basename "$SOURCE")"
fi
while [[ -h "$SOURCE" ]]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "${DIR}"
}
if [[ -n "${BASH_SOURCE[0]}" ]]; then
_script_path="${BASH_SOURCE[0]}"
elif [[ -n "${(%):-%x}" ]]; then
_script_path="${(%):-%x}"
else
echo "ERROR: Cannot determine script location" >&2
exit 1
fi
SCRIPT_DIR="$(_resolveSelfDir "$_script_path")"
# Default subcommand is 'commit'
SUBCOMMAND="${1:-commit}"
case "$SUBCOMMAND" in
commit)
shift 2>/dev/null || true
exec "$SCRIPT_DIR/commit.sh" "$@"
;;
validate)
shift
exec "$SCRIPT_DIR/validate.sh" "$@"
;;
--help|-h)
echo "Usage: dco <command> [options]"
echo ""
echo "Commands:"
echo " commit Sign the DCO and commit (default)"
echo " validate Validate DCO signatures on commits"
echo ""
echo "Commit options:"
echo " --signing-key <path> SSH key for cryptographic signing"
echo " --yes-signoff Auto-agree to DCO terms"
echo " <git arguments> Passed through to git commit"
echo ""
echo "Validate options:"
echo " --verbose Show detailed output"
echo " --enforce-signature-fingerprints Require SSH signature fingerprints"
exit 0
;;
*)
echo "Unknown command: $SUBCOMMAND" >&2
echo "Usage: dco <commit|validate> [options]" >&2
exit 1
;;
esac