Skip to content

Commit 4b6d59a

Browse files
committed
Add help
1 parent 32e8664 commit 4b6d59a

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

snippet

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,37 @@ usage() {
4242
[ -n "$1" ] && echo "$1" >&2
4343
exitcode="${2:-1}"
4444
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+
4676
USAGE
4777
exit "$exitcode"
4878
}
@@ -130,8 +160,10 @@ snippet_curl() {
130160
_path=${1:-}
131161
shift
132162
fi
163+
_opts="-sSL"
164+
yush_loglevel_le "trace" && _opts="-vSL"
133165
yush_debug "Curling ${GITLAB_ROOT%/}/projects/${GITLAB_PROJECT}/snippets/${_path%/} with $*"
134-
curl -sSL \
166+
curl "$_opts" \
135167
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
136168
"$@" \
137169
"${GITLAB_ROOT%/}/projects/${GITLAB_PROJECT}/snippets/${_path%/}"

0 commit comments

Comments
 (0)