Skip to content

Commit 5984473

Browse files
committed
chore: use different default max values for search
Depending on wether we use interactive mode or not
1 parent e7ad290 commit 5984473

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/org/codejive/jpm/Main.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ static class Sync implements Callable<Integer> {
9090

9191
@Option(
9292
names = {"-m", "--max"},
93-
description = "Maximum number of results to return",
94-
defaultValue = "20")
95-
private int max;
93+
description = "Maximum number of results to return")
94+
private Integer max;
9695

9796
@Parameters(
9897
paramLabel = "artifactPattern",
@@ -103,6 +102,9 @@ static class Sync implements Callable<Integer> {
103102
@Override
104103
public Integer call() throws Exception {
105104
if (interactive || artifactPattern == null || artifactPattern.isEmpty()) {
105+
if (max == null) {
106+
max = 100;
107+
}
106108
try (Terminal terminal = TerminalBuilder.builder().build()) {
107109
while (true) {
108110
ConsolePrompt prompt = new ConsolePrompt(terminal);
@@ -151,6 +153,9 @@ public Integer call() throws Exception {
151153
}
152154
}
153155
} else {
156+
if (max == null) {
157+
max = 20;
158+
}
154159
String[] artifactNames = search(artifactPattern);
155160
if (artifactNames.length > 0) {
156161
Arrays.stream(artifactNames).forEach(System.out::println);

0 commit comments

Comments
 (0)