001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.cli.processor;
007
008import org.apache.commons.cli.Option;
009
010import edu.umd.cs.findbugs.annotations.NonNull;
011
012/**
013 * A collection of utilities for handling command line options.
014 */
015public final class OptionUtils {
016
017  private OptionUtils() {
018    // disable construction
019  }
020
021  /**
022   * Generate the argument text for the given option.
023   *
024   * @param option
025   *          the CLI option
026   * @return the argument text
027   */
028  @NonNull
029  public static String toArgument(@NonNull Option option) {
030    return option.hasLongOpt() ? "--" + option.getLongOpt() : "-" + option.getOpt();
031  }
032
033}