Skip to content

Commit c7e84ec

Browse files
committed
WIP
1 parent 0ae0876 commit c7e84ec

17 files changed

+47
-57
lines changed

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Classpath.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ public final class Classpath extends ResolverCommandSupport {
3434
private java.util.List<String> boms;
3535

3636
@Override
37-
protected Integer doCall(Context context) throws Exception {
37+
protected boolean doCall(Context context) throws Exception {
3838
ToolboxCommando toolboxCommando = ToolboxCommando.getOrCreate(context);
3939
return toolboxCommando.classpath(
40-
ResolutionScope.parse(resolutionScope),
41-
toolboxCommando.toolboxResolver().loadGav(gav, boms),
42-
output)
43-
? 0
44-
: 1;
40+
ResolutionScope.parse(resolutionScope),
41+
toolboxCommando.toolboxResolver().loadGav(gav, boms),
42+
output);
4543
}
4644
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/CommandSupport.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,12 @@ protected String getLocation(final StackTraceElement e) {
395395
public final Integer call() {
396396
Ansi.setEnabled(color);
397397
try (Context context = getContext()) {
398-
return doCall(context);
398+
return doCall(context) ? 0 : 1;
399399
} catch (Exception e) {
400400
error("Error", e);
401401
return 1;
402402
}
403403
}
404404

405-
protected abstract Integer doCall(Context context) throws Exception;
405+
protected abstract boolean doCall(Context context) throws Exception;
406406
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Deploy.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public final class Deploy extends ResolverCommandSupport {
3636
private String remoteRepositorySpec;
3737

3838
@Override
39-
protected Integer doCall(Context context) throws DeploymentException {
39+
protected boolean doCall(Context context) throws DeploymentException {
4040
ArrayList<Artifact> artifacts = new ArrayList<>();
4141
artifacts.add(new DefaultArtifact(gav).setFile(jar.toFile()));
4242
artifacts.add(new SubArtifact(artifacts.get(0), "", "pom").setFile(pom.toFile()));
43-
return ToolboxCommando.getOrCreate(getContext()).deploy(remoteRepositorySpec, artifacts, output) ? 0 : 1;
43+
return ToolboxCommando.getOrCreate(getContext()).deploy(remoteRepositorySpec, artifacts, output);
4444
}
4545
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/DeployRecorded.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ public final class DeployRecorded extends ResolverCommandSupport {
2222
private String remoteRepositorySpec;
2323

2424
@Override
25-
protected Integer doCall(Context context) throws DeploymentException {
25+
protected boolean doCall(Context context) throws DeploymentException {
2626
normal("Deploying recorded");
2727

2828
ToolboxCommando toolboxCommando = ToolboxCommando.getOrCreate(getContext());
2929
toolboxCommando.artifactRecorder().setActive(false);
3030
return toolboxCommando.deploy(
31-
remoteRepositorySpec,
32-
new HashSet<>(toolboxCommando.artifactRecorder().getAllArtifacts()),
33-
output)
34-
? 0
35-
: 1;
31+
remoteRepositorySpec,
32+
new HashSet<>(toolboxCommando.artifactRecorder().getAllArtifacts()),
33+
output);
3634
}
3735
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Dump.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
@CommandLine.Command(name = "dump", description = "Dump MIMA environment")
1717
public final class Dump extends CommandSupport {
1818
@Override
19-
protected Integer doCall(Context context) {
19+
protected boolean doCall(Context context) {
2020
mayDumpEnv(getRuntime(), context, true);
21-
return 0;
21+
return true;
2222
}
2323
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Exists.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ public final class Exists extends SearchCommandSupport {
4848
private boolean allRequired;
4949

5050
@Override
51-
protected Integer doCall(Context context) throws IOException {
51+
protected boolean doCall(Context context) throws IOException {
5252
return ToolboxCommando.getOrCreate(context)
53-
.exists(getRemoteRepository(), gav, pom, sources, javadoc, signature, allRequired, output)
54-
? 0
55-
: 1;
53+
.exists(getRemoteRepository(), gav, pom, sources, javadoc, signature, allRequired, output);
5654
}
5755
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Identify.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public final class Identify extends SearchCommandSupport {
2222
private String target;
2323

2424
@Override
25-
protected Integer doCall(Context context) throws IOException {
26-
return ToolboxCommando.getOrCreate(context).identify(getRemoteRepository(), target, output) ? 0 : 1;
25+
protected boolean doCall(Context context) throws IOException {
26+
return ToolboxCommando.getOrCreate(context).identify(getRemoteRepository(), target, output);
2727
}
2828
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Install.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public final class Install extends ResolverCommandSupport {
3333
private Path pom;
3434

3535
@Override
36-
protected Integer doCall(Context context) throws InstallationException {
36+
protected boolean doCall(Context context) throws InstallationException {
3737
ArrayList<Artifact> artifacts = new ArrayList<>();
3838
artifacts.add(new DefaultArtifact(gav).setFile(jar.toFile()));
3939
artifacts.add(new SubArtifact(artifacts.get(0), "", "pom").setFile(pom.toFile()));
40-
return ToolboxCommando.getOrCreate(getContext()).install(artifacts, output) ? 0 : 1;
40+
return ToolboxCommando.getOrCreate(getContext()).install(artifacts, output);
4141
}
4242
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/List.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public final class List extends SearchCommandSupport {
2222
private String gavoid;
2323

2424
@Override
25-
protected Integer doCall(Context context) throws IOException {
26-
return ToolboxCommando.getOrCreate(context).list(getRemoteRepository(), gavoid, output) ? 0 : 1;
25+
protected boolean doCall(Context context) throws IOException {
26+
return ToolboxCommando.getOrCreate(context).list(getRemoteRepository(), gavoid, output);
2727
}
2828
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/ListAvailablePlugins.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public final class ListAvailablePlugins extends ResolverCommandSupport {
2222
private String g;
2323

2424
@Override
25-
protected Integer doCall(Context context) throws Exception {
26-
return ToolboxCommando.getOrCreate(context).listAvailablePlugins(Collections.singletonList(g), output) ? 0 : 1;
25+
protected boolean doCall(Context context) throws Exception {
26+
return ToolboxCommando.getOrCreate(context).listAvailablePlugins(Collections.singletonList(g), output);
2727
}
2828
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Main.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public String[] getVersion() {
4242
}
4343

4444
@Override
45-
protected Integer doCall(Context context) {
45+
protected boolean doCall(Context context) {
4646
mayDumpEnv(getRuntime(), context, false);
4747
return new Repl().doCall(context);
4848
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Record.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
public final class Record extends ResolverCommandSupport {
2020

2121
@Override
22-
protected Integer doCall(Context context) throws DependencyResolutionException {
23-
return ToolboxCommando.getOrCreate(context).artifactRecorder().setActive(true) ? 0 : 1;
22+
protected boolean doCall(Context context) throws DependencyResolutionException {
23+
return ToolboxCommando.getOrCreate(context).artifactRecorder().setActive(true);
2424
}
2525
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Repl.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@CommandLine.Command(name = "repl", description = "REPL console")
3535
public class Repl extends CommandSupport {
3636
@Override
37-
public Integer doCall(Context context) {
37+
public boolean doCall(Context context) {
3838
Class<?> tp = JansiTerminalProvider.class;
3939
push(Context.class.getName(), context);
4040

@@ -81,15 +81,15 @@ public Integer doCall(Context context) {
8181
} catch (UserInterruptException e) {
8282
// Ignore
8383
} catch (EndOfFileException e) {
84-
return 0;
84+
return true;
8585
} catch (Exception e) {
8686
systemRegistry.trace(e);
87-
return 2;
87+
return false;
8888
}
8989
}
9090
} catch (Exception e) {
9191
error("REPL Failure: ", e);
92-
return 1;
92+
return false;
9393
} finally {
9494
context.close();
9595
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Resolve.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,14 @@ public final class Resolve extends ResolverCommandSupport {
5050
private boolean signature;
5151

5252
@Override
53-
protected Integer doCall(Context context) throws Exception {
53+
protected boolean doCall(Context context) throws Exception {
5454
ToolboxCommando toolboxCommando = ToolboxCommando.getOrCreate(context);
5555
return toolboxCommando.resolve(
56-
ResolutionScope.parse(resolutionScope),
57-
toolboxCommando.toolboxResolver().loadGav(gav, boms),
58-
sources,
59-
javadoc,
60-
signature,
61-
output)
62-
? 0
63-
: 1;
56+
ResolutionScope.parse(resolutionScope),
57+
toolboxCommando.toolboxResolver().loadGav(gav, boms),
58+
sources,
59+
javadoc,
60+
signature,
61+
output);
6462
}
6563
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Search.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public final class Search extends SearchCommandSupport {
2222
private String expression;
2323

2424
@Override
25-
protected Integer doCall(Context context) throws IOException {
26-
return ToolboxCommando.getOrCreate(context).search(getRemoteRepository(), expression, output) ? 0 : 1;
25+
protected boolean doCall(Context context) throws IOException {
26+
return ToolboxCommando.getOrCreate(context).search(getRemoteRepository(), expression, output);
2727
}
2828
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Tree.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ public final class Tree extends ResolverCommandSupport {
4141
private java.util.List<String> boms;
4242

4343
@Override
44-
protected Integer doCall(Context context) throws Exception {
44+
protected boolean doCall(Context context) throws Exception {
4545
ToolboxCommando toolboxCommando = ToolboxCommando.getOrCreate(context);
4646
return toolboxCommando.tree(
47-
ResolutionScope.parse(resolutionScope),
48-
toolboxCommando.toolboxResolver().loadGav(gav, boms),
49-
verboseTree,
50-
output)
51-
? 0
52-
: 1;
47+
ResolutionScope.parse(resolutionScope),
48+
toolboxCommando.toolboxResolver().loadGav(gav, boms),
49+
verboseTree,
50+
output);
5351
}
5452
}

cli/src/main/java/eu/maveniverse/maven/toolbox/cli/Verify.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class Verify extends SearchCommandSupport {
2525
private String sha1;
2626

2727
@Override
28-
protected Integer doCall(Context context) throws IOException {
29-
return ToolboxCommando.getOrCreate(context).verify(getRemoteRepository(), gav, sha1, output) ? 0 : 1;
28+
protected boolean doCall(Context context) throws IOException {
29+
return ToolboxCommando.getOrCreate(context).verify(getRemoteRepository(), gav, sha1, output);
3030
}
3131
}

0 commit comments

Comments
 (0)