-
Notifications
You must be signed in to change notification settings - Fork 18
/
glPut.sh
executable file
·63 lines (51 loc) · 1.09 KB
/
glPut.sh
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
#!/bin/bash
function display_usage {
echo "Usage: $0
$0 --uri GL_URI
$0 --uri GL_URI --params 'PARAM1=VALUE1&PARAM2=VALUE2
" >&2
exit 100
}
function main {
local api_url=
local api_params=
while [[ $# -gt 0 ]]; do
local param="$1"
shift
case "${param}" in
'--uri'|'--url'|'-u')
api_url="$1"
shift
;;
'--params'|'-p')
api_params="$1"
shift
;;
*)
# unknown option
echo "Undefine parameter ${param}" >&2
display_usage
;;
esac
done
if [ -z "${api_url}" ] ; then
echo "** Missing parameter --uri" >&2
display_usage
fi
gitlab_put "${api_url}" "${api_params}"
}
# Configuration - BEGIN
if [ -z "$GITLAB_BASH_API_PATH" ]; then
GITLAB_BASH_API_PATH=$(dirname "$(realpath "$0")")
fi
if [ ! -f "${GITLAB_BASH_API_PATH}/api/gitlab-bash-api.sh" ]; then
echo "gitlab-bash-api.sh not found! - Please set GITLAB_BASH_API_PATH" >&2
exit 1
fi
source "${GITLAB_BASH_API_PATH}/api/gitlab-bash-api.sh"
# Configuration - END
# Script start here
if [ $# -eq 0 ]; then
display_usage
fi
main "$@"