Skip to content

Commit

Permalink
Add help command
Browse files Browse the repository at this point in the history
This is mainly created for testing the conda installation
  • Loading branch information
minnerbe committed Jun 21, 2023
1 parent 3cf9ba4 commit 41683da
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/cmd/PrintHelp.java
Original file line number Diff line number Diff line change
@@ -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<Void> {

@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<String, Callable<Void>> 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<String, Callable<Void>> 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);
}
}

0 comments on commit 41683da

Please sign in to comment.