From 41683daee5812536090eb0911f00ec52037540b4 Mon Sep 17 00:00:00 2001 From: Michael Innerberger Date: Wed, 21 Jun 2023 08:34:53 -0400 Subject: [PATCH] Add help command This is mainly created for testing the conda installation --- install | 2 ++ src/main/java/cmd/PrintHelp.java | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/main/java/cmd/PrintHelp.java diff --git a/install b/install index 404a326..81d91a0 100755 --- a/install +++ b/install @@ -63,6 +63,7 @@ install_command st-add-annotations "cmd.AddAnnotations" install_command st-align-pairs "cmd.PairwiseSectionAligner" install_command st-align-pairs-view "cmd.ViewPairwiseAlignment" install_command st-align-global "cmd.GlobalOpt" +install_command st-help "cmd.PrintHelp" if [ $(pwd) == "$INSTALL_DIR" ]; then echo "Installation directory equals current directory, we are done." @@ -79,6 +80,7 @@ else mv st-align-pairs $INSTALL_DIR/ mv st-align-pairs-view $INSTALL_DIR/ mv st-align-global $INSTALL_DIR/ + mv st-help $INSTALL_DIR/ fi rm cp.txt diff --git a/src/main/java/cmd/PrintHelp.java b/src/main/java/cmd/PrintHelp.java new file mode 100644 index 0000000..ecabff1 --- /dev/null +++ b/src/main/java/cmd/PrintHelp.java @@ -0,0 +1,48 @@ +package cmd; + +import picocli.CommandLine; +import picocli.CommandLine.Option; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.Callable; + +public class PrintHelp implements Callable { + + @Option(names = {"-v", "--version"}, required = false, description = "print version information") + private boolean version = false; + + @Override + public Void call() throws Exception { + + if (version) { + System.out.println("Spatial Transcriptomics as IMages project -- v0.2.0"); + return null; + } + + final Map> commands = new HashMap<>(); + commands.put("st-explorer", new View()); + commands.put("st-render", new RenderImage()); + commands.put("st-bdv-view", new DisplayStackedSlides()); + commands.put("st-resave", new Resave()); + commands.put("st-add-slice", new AddDataset()); + commands.put("st-normalize", new Normalize()); + commands.put("st-add-annotations", new AddAnnotations()); + commands.put("st-align-pairs", new PairwiseSectionAligner()); + commands.put("st-align-pairs-view", new ViewPairwiseAlignment()); + commands.put("st-align-global", new GlobalOpt()); + + for (final Entry> command : commands.entrySet()) { + System.out.println(); + System.out.println("Usage for " + command.getKey() + ":"); + CommandLine.usage(command.getValue(), System.out); + } + + return null; + } + + public static void main(final String[] args) { + CommandLine.call(new PrintHelp(), args); + } +}