@@ -42,7 +42,37 @@ usage() {
42
42
[ -n " $1 " ] && echo " $1 " >&2
43
43
exitcode=" ${2:- 1} "
44
44
cat << USAGE >&2
45
- Yet to be documented
45
+
46
+ Description:
47
+
48
+ $YUSH_APPNAME provides an interface to the gitlab snippets API for automation
49
+
50
+ Usage:
51
+ $( basename " $0 " ) [-option arg --long-option(=)arg] (--) command ..
52
+
53
+ where all dash-led options are as follows (long options can be followed by
54
+ an equal sign):
55
+ -g | --gitlab Host where to find the gitlab API at, default: gitlab.com
56
+ -r | --root Fully qualified URL of gitlab API root, defaults to empty
57
+ meaning that it will be constructed from --gitlab.
58
+ -t | --token Authentication token
59
+ -p | --project Full path to project or numerical project ID
60
+ -h | --help Print this help and exit
61
+ -v | --verbose Verbosity level
62
+
63
+ Commands:
64
+
65
+ This script accepts the following commands. Consult the documentation for more
66
+ details: https://github.com/YanziNetworks/gitlab-snippet
67
+
68
+ list List identifiers of accessible snippets (default when no command
69
+ specified)
70
+ get|read Get raw content of snippet
71
+ details Get JSON or parsed JSON content of snippet
72
+ add|create Create new snippet
73
+ update|change Change existing snippet
74
+ delete|remove Delete existing snippet
75
+
46
76
USAGE
47
77
exit " $exitcode "
48
78
}
@@ -130,8 +160,10 @@ snippet_curl() {
130
160
_path=${1:- }
131
161
shift
132
162
fi
163
+ _opts=" -sSL"
164
+ yush_loglevel_le " trace" && _opts=" -vSL"
133
165
yush_debug " Curling ${GITLAB_ROOT%/ } /projects/${GITLAB_PROJECT} /snippets/${_path%/ } with $* "
134
- curl -sSL \
166
+ curl " $_opts " \
135
167
--header " PRIVATE-TOKEN: ${GITLAB_TOKEN} " \
136
168
" $@ " \
137
169
" ${GITLAB_ROOT%/ } /projects/${GITLAB_PROJECT} /snippets/${_path%/ } "
0 commit comments