DocAsCode.java

  1. package org.docascode.cli;

  2. import org.docascode.api.core.errors.DocAsCodeException;
  3. import picocli.CommandLine;

  4. import java.util.List;

  5. @CommandLine.Command(name = "docascode",
  6.         versionProvider = DocAsCode.ManifestVersionProvider.class,
  7.         subcommands = {
  8.             Update.class,
  9.             Init.class,
  10.             Add.class,
  11.             Build.class,
  12.             Remove.class,
  13.             PreCommit.class,
  14.             PostCommit.class,
  15.             Diff.class,
  16.             Merge.class},
  17.         description="DocAsCode is a toolchain designed for handling and delivering OpenXML files. See more at 'https://gitlab.com/docascode/docascode'.")
  18. public class DocAsCode extends Command implements Runnable{

  19.     static class ManifestVersionProvider implements picocli.CommandLine.IVersionProvider {
  20.         public String[] getVersion() throws DocAsCodeException {
  21.             List<String> versionInfos = org.docascode.api.DocAsCode.getVersionInformations();
  22.             String[] versions = new String[versionInfos.size()];
  23.             versions = versionInfos.toArray(versions);
  24.             return versions;
  25.             }
  26.         }

  27.     @CommandLine.Option(names = { "-v", "--version" }, versionHelp = true, description = "Show version information and exit")
  28.     boolean versionHelpRequested;

  29.     @Override
  30.     public void run() {
  31.         usageHelpRequested=true;
  32.     }
  33. }