1 /* 2 * SPDX-FileCopyrightText: none 3 * SPDX-License-Identifier: CC0-1.0 4 */ 5 6 package gov.nist.secauto.metaschema.cli.processor; 7 8 import org.apache.commons.cli.Option; 9 10 import edu.umd.cs.findbugs.annotations.NonNull; 11 12 /** 13 * A collection of utilities for handling command line options. 14 */ 15 public final class OptionUtils { 16 17 private OptionUtils() { 18 // disable construction 19 } 20 21 /** 22 * Generate the argument text for the given option. 23 * 24 * @param option 25 * the CLI option 26 * @return the argument text 27 */ 28 @NonNull 29 public static String toArgument(@NonNull Option option) { 30 return option.hasLongOpt() ? "--" + option.getLongOpt() : "-" + option.getOpt(); 31 } 32 33 }