Skip to content

Commit 952f941

Browse files
committed
Update LabelGraphQLScript to support new parameters
1 parent f82a4c0 commit 952f941

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

gitlab4j-test/LabelGraphQLScript.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///usr/bin/env jbang "$0" "$@" ; exit $?
22

33
//DEPS info.picocli:picocli:4.6.3
4-
//DEPS https://github.com/unblu/gitlab-workitem-graphql-client/commit/f36726404b311bab0d5df41eff8072950fb9f97c
4+
//DEPS https://github.com/unblu/gitlab-workitem-graphql-client/commit/f98e830badf88a74e459807f14c7db3b4a32c012
55
//DEPS io.smallrye:smallrye-graphql-client-implementation-vertx:2.11.0
66
//DEPS org.jboss.logmanager:jboss-logmanager:3.1.1.Final
77
//JAVA 17
@@ -50,9 +50,15 @@ public class LabelGraphQLScript implements Callable<Integer> {
5050
@Option(names = { "-g", "--group" }, description = "group")
5151
private String group;
5252

53-
@Option(names = { "-a", "--includeAncestorGroups" }, description = "include ancestor groups when fetching labels")
53+
@Option(names = { "-a", "--includeAncestorGroups" }, description = "include ancestor groups when fetching labels in project")
5454
private boolean includeAncestorGroups;
5555

56+
@Option(names = { "-d", "--includeDescendantGroups" }, description = "include descendant groups when fetching labels in group")
57+
private boolean includeDescendantGroups;
58+
59+
@Option(names = { "-o", "--onlyGroupLabels" }, description = "set onlyGroupLabels when fetching labels in group")
60+
private boolean onlyGroupLabels;
61+
5662
@Option(names = { "-c", "--config" }, description = "configuration file location")
5763
String configFile;
5864

@@ -95,13 +101,15 @@ private void listLabels(WorkitemClientApi api) {
95101
labels = getLabels(apiCall, lGetter);
96102
} else if (group != null) {
97103
System.out.println("Reading gitlab labels and metadata from group " + group);
98-
Function<String, Group> apiCall = (from) -> api.group(group, includeAncestorGroups, from);
104+
Function<String, Group> apiCall = (from) -> api.group(group, includeDescendantGroups, onlyGroupLabels, from);
99105
Function<Group, LabelConnection> lGetter = Group::getLabels;
100106
labels = getLabels(apiCall, lGetter);
101107
} else {
102108
throw new IllegalStateException("Unexpected");
103109
}
104110

111+
System.out.println("---> labels found: " + labels.size());
112+
105113
for (Label label : labels) {
106114
System.out.println(label.getId() + " " + label.getTitle());
107115
}

0 commit comments

Comments
 (0)