public String getParsedVersion() {
   Version version = VersionHelper.valueOf(getVersion());
   if (version == null) {
     return null;
   }
   return version.toString();
 }
  public static void main(String[] args) throws Exception {

    // create Options object
    Options options = new Options();

    options.addOption("b", "branch", true, "force branch name in case of a detached repo");
    options.addOption(
        "s", "snapshot", false, "Use Maven SNAPSHOT instead of semver build metadata");
    options.addOption("m", "maven", false, "Maven compatible semver versions");
    options.addOption("l", "logLevel", true, "Configures log level to TRACE|DEBUG|INFO|WARN|ERROR");

    CommandLineParser parser = new DefaultParser();
    CommandLine cmd = parser.parse(options, args);

    String logLevel = cmd.getOptionValue("l", "error"); // $NON-NLS-1$
    System.setProperty("org.slf4j.simpleLogger.log.com.quicksign", logLevel); // $NON-NLS-1$
    LOGGER = LoggerFactory.getLogger(JGitFlowSemver.class);

    final GitflowVersioningConfiguration conf = new GitflowVersioningConfiguration();
    try {
      // parse the command line arguments
      CommandLine line = parser.parse(options, args);
      if (line.hasOption('b')) {
        conf.setForceBranch(line.getOptionValue('b'));
        LOGGER.debug("Forcing branch name {}", conf.getForceBranch());
      }
      if (line.hasOption('s')) {
        conf.useMavenSnapshot();
        LOGGER.debug("Maven snapshots mode");
      }
      if (line.hasOption('m')) {
        conf.mavenCompatibility();
        LOGGER.debug("Maven compatibility mode");
      }
      args = line.getArgs();
    } catch (ParseException exp) {
      printUsage(options, System.err);
      System.exit(1);
    }

    if (args.length != 1) {
      printUsage(options, System.err);
      System.exit(1);
    }

    try {
      Version v = null;
      final File root = new File(args[0]).getAbsoluteFile();
      final File dir = new File(root, ".git");
      conf.setRepositoryRoot(dir.getPath());

      if (new File(root, "pom.xml").exists()) {
        LOGGER.debug("Detected Maven pom.xml so activating Maven compatibility");
        conf.mavenCompatibility();
      }

      v = new JGitFlowSemver(dir, conf).infer();
      String adjusted = v.toString();
      if (conf.isMavenCompatibility()) {
        adjusted = adjusted.replaceAll("\\+", ".");
      }
      System.out.println(adjusted);
    } catch (Exception e) {
      System.err.println("An error ocured: " + e);
      LOGGER.error("An error occured", e);
      System.exit(2);
    }
  }