diff --git a/com.io7m.jspiel.cmdline/pom.xml b/com.io7m.jspiel.cmdline/pom.xml
index 90a2360..9c86d4f 100644
--- a/com.io7m.jspiel.cmdline/pom.xml
+++ b/com.io7m.jspiel.cmdline/pom.xml
@@ -36,20 +36,17 @@
slf4j-api
- com.io7m.jaffirm
- com.io7m.jaffirm.core
-
-
- com.io7m.junreachable
- com.io7m.junreachable.core
+ ch.qos.logback
+ logback-classic
+
- com.beust
- jcommander
+ com.io7m.quarrel
+ com.io7m.quarrel.core
- ch.qos.logback
- logback-classic
+ com.io7m.quarrel
+ com.io7m.quarrel.ext.logback
@@ -57,60 +54,137 @@
org.osgi.annotation.bundle
provided
+
+ org.osgi
+ org.osgi.annotation.versioning
+ provided
+
+
+
+
+
+ org.cyclonedx
+ cyclonedx-maven-plugin
+
+
+ default
+
+ makeAggregateBom
+
+ prepare-package
+
+
+
+
+
+
+
org.apache.maven.plugins
- maven-checkstyle-plugin
+ maven-dependency-plugin
+
+ true
+
+
+ com.io7m.jspiel:*
+
+
+ ch.qos.logback:logback-classic:*
+
+
+
-
- org.apache.maven.plugins
- maven-shade-plugin
+ com.io7m.stmp
+ string-template-maven-plugin
- package
+ generate-version
+ generate-sources
- shade
+ renderTemplate
- false
- false
- main
- true
-
-
-
-
- com.io7m.jspiel.cmdline.Main
-
-
-
+
+ RiffMainVersion
+
+ ${project.basedir}/src/main/string-template/RiffMainVersion.st
+
+
+ ${project.build.directory}/generated-sources/string-template/com/io7m/jspiel/cmdline/RiffMainVersion.java
+
+
+ ${project.version}
+ ${buildNumber}
+
+
-
- io.github.zlika
- reproducible-build-maven-plugin
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ add-jooq-sources
+ generate-sources
+
+ add-source
+
+
+
+
+
+
+
+
-
org.apache.maven.plugins
- maven-dependency-plugin
-
- true
-
- com.io7m.jspiel:com.io7m.jspiel.vanilla:*
- com.io7m.jaffirm:com.io7m.jaffirm.core:*
-
-
+ maven-assembly-plugin
+
+
+ distribution
+
+ single
+
+ package
+
+ true
+
+ src/main/assembly/distribution.xml
+
+
+
+
+
+
+
+ io.github.zlika
+ reproducible-build-maven-plugin
+
+
+ reproducible-zip
+ package
+
+ strip-jar
+
+
+ true
+
+ .*\.zip
+
+
+
+
diff --git a/com.io7m.jspiel.cmdline/src/main/assembly/distribution.xml b/com.io7m.jspiel.cmdline/src/main/assembly/distribution.xml
new file mode 100644
index 0000000..1000440
--- /dev/null
+++ b/com.io7m.jspiel.cmdline/src/main/assembly/distribution.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ distribution
+
+ jspiel
+
+
+ dir
+ zip
+
+
+
+
+ lib
+ true
+ true
+
+
+
+
+
+
+ /bin
+ 0755
+
+
+
+
+ 0644
+
+
+
+
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandRoot.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandRoot.java
deleted file mode 100644
index 2a25596..0000000
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandRoot.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package com.io7m.jspiel.cmdline;
-
-import com.beust.jcommander.Parameter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class CommandRoot implements CommandType
-{
- @Parameter(
- names = "--verbose",
- converter = RiffLogLevelConverter.class,
- description = "Set the minimum logging verbosity level")
- private RiffLogLevel verbose = RiffLogLevel.LOG_INFO;
-
- CommandRoot()
- {
-
- }
-
- @Override
- public Void call()
- throws Exception
- {
- final var root =
- (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(
- Logger.ROOT_LOGGER_NAME);
- root.setLevel(this.verbose.toLevel());
- return null;
- }
-}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandType.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandType.java
deleted file mode 100644
index 1cb9f17..0000000
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandType.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-package com.io7m.jspiel.cmdline;
-
-import java.util.concurrent.Callable;
-
-/**
- * The type of command-line subcommands.
- */
-
-public interface CommandType extends Callable
-{
- // No extra methods
-}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/Main.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/Main.java
deleted file mode 100644
index 59decb4..0000000
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/Main.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package com.io7m.jspiel.cmdline;
-
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.ParameterException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * The main command-line program.
- */
-
-public final class Main implements Runnable
-{
- private static final Logger LOG = LoggerFactory.getLogger(Main.class);
-
- private final Map commands;
- private final JCommander commander;
- private final String[] args;
- private int exit_code;
-
- /**
- * Construct a new main program.
- *
- * @param in_args Command-line arguments
- */
-
- public Main(final String[] in_args)
- {
- this.args = Objects.requireNonNull(in_args, "args");
-
- final var r = new CommandRoot();
- final var cmd_show = new CommandShow();
-
- this.commands = new HashMap<>(8);
- this.commands.put("show", cmd_show);
-
- this.commander = new JCommander(r);
- this.commander.setProgramName("jspiel");
- this.commander.addCommand("show", cmd_show);
- }
-
- /**
- * The main entry point.
- *
- * @param args Command line arguments
- */
-
- public static void main(final String[] args)
- {
- final var cm = new Main(args);
- cm.run();
- System.exit(cm.exitCode());
- }
-
- /**
- * @return The program exit code
- */
-
- public int exitCode()
- {
- return this.exit_code;
- }
-
- @Override
- public void run()
- {
- final var console = new StringConsole();
-
- try {
- this.commander.setConsole(console);
- this.commander.parse(this.args);
-
- final var cmd = this.commander.getParsedCommand();
- if (cmd == null) {
- this.commander.setConsole(console);
- this.commander.usage();
- LOG.info("Arguments required.\n{}", console.text());
- return;
- }
-
- final var command = this.commands.get(cmd);
- command.call();
- } catch (final ParameterException e) {
- this.commander.usage();
- LOG.error("{}\n{}", e.getMessage(), console.text());
- this.exit_code = 1;
- } catch (final Exception e) {
- LOG.error("{}", e.getMessage(), e);
- this.exit_code = 1;
- }
- }
-}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandShow.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffCmdShow.java
similarity index 53%
rename from com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandShow.java
rename to com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffCmdShow.java
index dcb28b9..57adb9b 100644
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/CommandShow.java
+++ b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffCmdShow.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
+ * Copyright © 2024 Mark Raynsford https://www.io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -14,55 +14,94 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
package com.io7m.jspiel.cmdline;
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
import com.io7m.jspiel.api.RiffChunkType;
import com.io7m.jspiel.api.RiffFileParserProviderType;
+import com.io7m.quarrel.core.QCommandContextType;
+import com.io7m.quarrel.core.QCommandMetadata;
+import com.io7m.quarrel.core.QCommandStatus;
+import com.io7m.quarrel.core.QCommandType;
+import com.io7m.quarrel.core.QParameterNamed1;
+import com.io7m.quarrel.core.QParameterNamedType;
+import com.io7m.quarrel.core.QStringType;
+import com.io7m.quarrel.ext.logback.QLogback;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
+import java.util.List;
+import java.util.Optional;
import java.util.ServiceLoader;
import static java.nio.channels.FileChannel.MapMode.READ_ONLY;
import static java.nio.file.StandardOpenOption.READ;
-@Parameters(commandDescription = "Display the contents of a RIFF file")
-final class CommandShow extends CommandRoot
-{
- // CHECKSTYLE:OFF
+/**
+ * Display a RIFF file.
+ */
- @Parameter(
- names = "--file",
- required = true,
- description = "The RIFF file to display")
- Path path;
+public final class RiffCmdShow implements QCommandType
+{
+ private final QCommandMetadata metadata;
+
+ private static final QParameterNamed1 FILE =
+ new QParameterNamed1<>(
+ "--file",
+ List.of(),
+ new QStringType.QConstant("The configuration file."),
+ Optional.empty(),
+ Path.class
+ );
+
+ /**
+ * Construct a command.
+ */
+
+ public RiffCmdShow()
+ {
+ this.metadata = new QCommandMetadata(
+ "show",
+ new QStringType.QConstant("Show the given RIFF file."),
+ Optional.empty()
+ );
+ }
- // CHECKSTYLE:ON
+ @Override
+ public List> onListNamedParameters()
+ {
+ return QLogback.plusParameters(List.of(FILE));
+ }
@Override
- public Void call()
+ public QCommandStatus onExecute(
+ final QCommandContextType context)
throws Exception
{
- super.call();
+ QLogback.configure(context);
+
+ final var file =
+ context.parameterValue(FILE);
final var parsers =
ServiceLoader.load(RiffFileParserProviderType.class)
.findFirst()
.orElseThrow(() -> new IllegalStateException("No RIFF file parser service available"));
- try (var channel = FileChannel.open(this.path, READ)) {
- final var map = channel.map(READ_ONLY, 0L, channel.size());
- final var parser = parsers.createForByteBuffer(this.path.toUri(), map);
- final var file = parser.parse();
+ try (var channel = FileChannel.open(file, READ)) {
+ final var map =
+ channel.map(READ_ONLY, 0L, channel.size());
+ final var parser =
+ parsers.createForByteBuffer(file.toUri(), map);
+ final var riff =
+ parser.parse();
- for (final var chunk : file.chunks()) {
+ for (final var chunk : riff.chunks()) {
showChunk(chunk, 0);
}
}
- return null;
+ return QCommandStatus.SUCCESS;
}
private static void showChunk(
@@ -90,8 +129,9 @@ private static void showChunk(
}
}
- CommandShow()
+ @Override
+ public QCommandMetadata metadata()
{
-
+ return this.metadata;
}
}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevel.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevel.java
deleted file mode 100644
index a6af8ed..0000000
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevel.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package com.io7m.jspiel.cmdline;
-
-import ch.qos.logback.classic.Level;
-import com.io7m.junreachable.UnreachableCodeException;
-
-import java.util.Objects;
-
-/**
- * Log level.
- */
-
-public enum RiffLogLevel
-{
- /**
- * @see Level#TRACE
- */
-
- LOG_TRACE("trace"),
-
- /**
- * @see Level#DEBUG
- */
-
- LOG_DEBUG("debug"),
-
- /**
- * @see Level#INFO
- */
-
- LOG_INFO("info"),
-
- /**
- * @see Level#WARN
- */
-
- LOG_WARN("warn"),
-
- /**
- * @see Level#ERROR
- */
-
- LOG_ERROR("error");
-
-
- private final String name;
-
- RiffLogLevel(final String in_name)
- {
- this.name = Objects.requireNonNull(in_name);
- }
-
- @Override
- public String toString()
- {
- return this.name;
- }
-
- /**
- * @return The short name of the level
- */
-
- public String getName()
- {
- return this.name;
- }
-
- Level toLevel()
- {
- switch (this) {
- case LOG_TRACE:
- return Level.TRACE;
- case LOG_DEBUG:
- return Level.DEBUG;
- case LOG_INFO:
- return Level.INFO;
- case LOG_WARN:
- return Level.WARN;
- case LOG_ERROR:
- return Level.ERROR;
- }
-
- throw new UnreachableCodeException();
- }
-}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevelConverter.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevelConverter.java
deleted file mode 100644
index ee72c5f..0000000
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevelConverter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package com.io7m.jspiel.cmdline;
-
-import com.beust.jcommander.IStringConverter;
-
-import java.util.Objects;
-
-/**
- * A converter for {@link RiffLogLevel} values.
- */
-
-public final class RiffLogLevelConverter implements IStringConverter
-{
- /**
- * Construct a new converter.
- */
-
- public RiffLogLevelConverter()
- {
-
- }
-
- @Override
- public RiffLogLevel convert(final String value)
- {
- for (final var v : RiffLogLevel.values()) {
- if (Objects.equals(value, v.getName())) {
- return v;
- }
- }
-
- throw new RiffLogLevelUnrecognized(
- "Unrecognized verbosity level: " + value);
- }
-}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffMain.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffMain.java
new file mode 100644
index 0000000..75c2b1e
--- /dev/null
+++ b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffMain.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright © 2023 Mark Raynsford https://www.io7m.com
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+package com.io7m.jspiel.cmdline;
+
+import com.io7m.quarrel.core.QApplication;
+import com.io7m.quarrel.core.QApplicationMetadata;
+import com.io7m.quarrel.core.QApplicationType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * The main entry point.
+ */
+
+public final class RiffMain implements Runnable
+{
+ private static final Logger LOG =
+ LoggerFactory.getLogger(RiffMain.class);
+
+ private final List args;
+ private final QApplicationType application;
+ private int exitCode;
+
+ /**
+ * The main entry point.
+ *
+ * @param inArgs Command-line arguments
+ */
+
+ public RiffMain(
+ final String[] inArgs)
+ {
+ this.args =
+ Objects.requireNonNull(List.of(inArgs), "Command line arguments");
+
+ final var metadata =
+ new QApplicationMetadata(
+ "jspiel",
+ "com.io7m.jspiel",
+ RiffMainVersion.MAIN_VERSION,
+ RiffMainVersion.MAIN_BUILD,
+ "The jspiel command-line.",
+ Optional.of(URI.create("https://www.io7m.com/software/jspiel/"))
+ );
+
+ final var builder = QApplication.builder(metadata);
+ builder.addCommand(new RiffCmdShow());
+
+ this.application = builder.build();
+ this.exitCode = 0;
+ }
+
+ /**
+ * The main entry point.
+ *
+ * @param args Command line arguments
+ */
+
+ public static void main(
+ final String[] args)
+ {
+ System.exit(mainExitless(args));
+ }
+
+ /**
+ * The main (exitless) entry point.
+ *
+ * @param args Command line arguments
+ *
+ * @return The exit kind
+ */
+
+ public static int mainExitless(
+ final String[] args)
+ {
+ final RiffMain cm = new RiffMain(args);
+ cm.run();
+ return cm.exitCode();
+ }
+
+ /**
+ * @return The application instance
+ */
+
+ public QApplicationType application()
+ {
+ return this.application;
+ }
+
+ /**
+ * @return The program exit kind
+ */
+
+ public int exitCode()
+ {
+ return this.exitCode;
+ }
+
+ @Override
+ public void run()
+ {
+ this.exitCode = this.application.run(LOG, this.args).exitCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format(
+ "[RiffMain 0x%s]",
+ Long.toUnsignedString(System.identityHashCode(this), 16)
+ );
+ }
+}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/StringConsole.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/StringConsole.java
deleted file mode 100644
index 89b31fe..0000000
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/StringConsole.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2020 Mark Raynsford https://www.io7m.com
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package com.io7m.jspiel.cmdline;
-
-import com.beust.jcommander.internal.Console;
-
-final class StringConsole implements Console
-{
- private final StringBuilder text;
-
- StringConsole()
- {
- this.text = new StringBuilder();
- }
-
- @Override
- public void print(final String msg)
- {
- this.text.append(msg);
- }
-
- @Override
- public void println(final String msg)
- {
- this.text.append(msg);
- this.text.append(System.lineSeparator());
- }
-
- @Override
- public char[] readPassword(final boolean echoInput)
- {
- return new char[0];
- }
-
- public StringBuilder text()
- {
- return this.text;
- }
-}
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/package-info.java b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/package-info.java
index c7976b0..973bb4a 100644
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/package-info.java
+++ b/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/package-info.java
@@ -18,5 +18,9 @@
* RIFF I/O (Command-line tools)
*/
-@org.osgi.annotation.bundle.Export
+@Export
+@Version("1.0.0")
package com.io7m.jspiel.cmdline;
+
+import org.osgi.annotation.bundle.Export;
+import org.osgi.annotation.versioning.Version;
diff --git a/com.io7m.jspiel.cmdline/src/main/java/module-info.java b/com.io7m.jspiel.cmdline/src/main/java/module-info.java
index 7c4124d..27b2563 100644
--- a/com.io7m.jspiel.cmdline/src/main/java/module-info.java
+++ b/com.io7m.jspiel.cmdline/src/main/java/module-info.java
@@ -20,17 +20,20 @@
module com.io7m.jspiel.cmdline
{
- requires ch.qos.logback.classic;
+ requires static org.osgi.annotation.bundle;
+ requires static org.osgi.annotation.versioning;
+
requires com.io7m.jspiel.api;
+
+ requires ch.qos.logback.classic;
requires com.io7m.junreachable.core;
- requires jcommander;
+ requires com.io7m.quarrel.core;
+ requires com.io7m.quarrel.ext.logback;
requires org.slf4j;
uses com.io7m.jspiel.api.RiffFileBuilderProviderType;
uses com.io7m.jspiel.api.RiffFileWriterProviderType;
uses com.io7m.jspiel.api.RiffFileParserProviderType;
- opens com.io7m.jspiel.cmdline to jcommander;
-
exports com.io7m.jspiel.cmdline;
}
diff --git a/com.io7m.jspiel.cmdline/src/main/sh/jspiel b/com.io7m.jspiel.cmdline/src/main/sh/jspiel
new file mode 100755
index 0000000..194787b
--- /dev/null
+++ b/com.io7m.jspiel.cmdline/src/main/sh/jspiel
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ -z "${JSPIEL_HOME}" ]
+then
+ echo "JSPIEL_HOME is unset" 1>&2
+ exit 1
+fi
+
+exec /usr/bin/env java \
+-p "${JSPIEL_HOME}/lib" \
+-m com.io7m.jspiel.cmdline/com.io7m.jspiel.cmdline.RiffMain \
+"$@"
diff --git a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevelUnrecognized.java b/com.io7m.jspiel.cmdline/src/main/string-template/RiffMainVersion.st
similarity index 71%
rename from com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevelUnrecognized.java
rename to com.io7m.jspiel.cmdline/src/main/string-template/RiffMainVersion.st
index b07b385..d6657ee 100644
--- a/com.io7m.jspiel.cmdline/src/main/java/com/io7m/jspiel/cmdline/RiffLogLevelUnrecognized.java
+++ b/com.io7m.jspiel.cmdline/src/main/string-template/RiffMainVersion.st
@@ -1,5 +1,9 @@
+RiffMainVersion(
+ appVersion,
+ appBuild) ::= <<
+
/*
- * Copyright © 2019 Mark Raynsford https://www.io7m.com
+ * Copyright © 2024 Mark Raynsford \ https://www.io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -16,10 +20,15 @@
package com.io7m.jspiel.cmdline;
-final class RiffLogLevelUnrecognized extends RuntimeException
+public final class RiffMainVersion
{
- RiffLogLevelUnrecognized(final String message)
+ public static final String MAIN_VERSION = "";
+ public static final String MAIN_BUILD = "";
+
+ private RiffMainVersion()
{
- super(message);
+
}
}
+
+>>
diff --git a/com.io7m.jspiel.tests/src/main/java/com/io7m/jspiel/tests/RiffCommandLineTest.java b/com.io7m.jspiel.tests/src/main/java/com/io7m/jspiel/tests/RiffCommandLineTest.java
index 2128cb3..dc3fc7a 100644
--- a/com.io7m.jspiel.tests/src/main/java/com/io7m/jspiel/tests/RiffCommandLineTest.java
+++ b/com.io7m.jspiel.tests/src/main/java/com/io7m/jspiel/tests/RiffCommandLineTest.java
@@ -16,7 +16,7 @@
package com.io7m.jspiel.tests;
-import com.io7m.jspiel.cmdline.Main;
+import com.io7m.jspiel.cmdline.RiffMain;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -42,7 +42,7 @@ private static Path createWAV()
@Test
public void testMainShowNoArgumentsFails()
{
- final var main = new Main(new String[] {
+ final var main = new RiffMain(new String[] {
"show"
});
@@ -53,7 +53,7 @@ public void testMainShowNoArgumentsFails()
@Test
public void testMainShowNonexistentFails()
{
- final var main = new Main(new String[] {
+ final var main = new RiffMain(new String[] {
"show",
"--file",
"/nonexistent"
@@ -69,7 +69,7 @@ public void testMainShowOK()
{
final var temp = createWAV();
- final var main = new Main(new String[] {
+ final var main = new RiffMain(new String[] {
"show",
"--file",
temp.toString()
@@ -85,7 +85,7 @@ public void testMainShowOKVerbose()
{
final var temp = createWAV();
- final var main = new Main(new String[] {
+ final var main = new RiffMain(new String[] {
"show",
"--verbose",
"trace",
@@ -100,7 +100,7 @@ public void testMainShowOKVerbose()
@Test
public void testMainNoArgumentsOK()
{
- final var main = new Main(new String[] {
+ final var main = new RiffMain(new String[] {
});
diff --git a/pom.xml b/pom.xml
index e98a6d0..b00ca09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,9 +36,11 @@
1.0.0
+ 1.6.1
2.10.1
+ 5.10.2
@@ -96,6 +98,7 @@
+
org.immutables
value
@@ -122,45 +125,52 @@
1.5.1
+
- com.io7m.primogenitor
- com.io7m.primogenitor.support
- 8.2.0
+ com.io7m.quarrel
+ com.io7m.quarrel.core
+ ${com.io7m.quarrel.version}
+
+ com.io7m.quarrel
+ com.io7m.quarrel.ext.logback
+ ${com.io7m.quarrel.version}
+
+
+ com.io7m.quarrel
+ com.io7m.quarrel.ext.xstructural
+ ${com.io7m.quarrel.version}
+
+
+
com.io7m.junreachable
com.io7m.junreachable.core
4.0.2
- com.beust
- jcommander
- 1.82
+ com.io7m.jaffirm
+ com.io7m.jaffirm.core
+ 4.0.1
org.slf4j
slf4j-api
2.0.13
-
- com.io7m.jaffirm
- com.io7m.jaffirm.core
- 4.0.1
-
ch.qos.logback
logback-classic
1.5.6
+
+
- org.junit.jupiter
- junit-jupiter-engine
- 5.10.2
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.10.2
+ org.junit
+ junit-bom
+ ${org.junit.version}
+ pom
+ import
nl.jqno.equalsverifier
@@ -178,6 +188,12 @@
+
+ com.io7m.stmp
+ string-template-maven-plugin
+ 2.0.0
+
+
org.apache.maven.plugins
maven-compiler-plugin