File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ ///usr/bin/env jbang "$0" "$@" ; exit $?
2
+
3
+ //DEPS org.gitlab4j:gitlab4j-api:5.4.0
4
+ //JAVA 17
5
+
6
+ import java .util .logging .Level ;
7
+ import java .util .logging .Logger ;
8
+
9
+ import org .gitlab4j .api .*;
10
+ import org .gitlab4j .api .models .*;
11
+
12
+ class GitlabScript {
13
+
14
+ public static void main (String ... args ) throws Exception {
15
+ if (args .length != 1 ) {
16
+ System .out .println ("Project id parameter is missing" );
17
+ System .exit (1 );
18
+ }
19
+ String projectId = args [0 ];
20
+
21
+ try (GitLabApi gitLabApi = new GitLabApi ("https://gitlab.com" , null )) {
22
+ Logger one = Logger .getLogger (GitlabScript .class .getName ());
23
+ gitLabApi .enableRequestResponseLogging (one , Level .INFO , 4096 );
24
+
25
+ Project project = gitLabApi .getProjectApi ()
26
+ .getProject (idOrPath (projectId ));
27
+ System .out .println (project );
28
+ }
29
+ }
30
+
31
+ private static Object idOrPath (String value ) {
32
+ if (value .matches ("[0-9]+" )) {
33
+ return Long .valueOf (value );
34
+ }
35
+ return value ;
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments