public static List<String> getCLIOptionNames(final Class<?> optClass) {
    final List<String> cliOpts = new ArrayList<>();
    final Field[] fields = optClass.getDeclaredFields();
    for (Field field : fields) {
      field.setAccessible(true);
      Annotation ann = field.getAnnotation(CommandLine.Option.class);
      if (ann != null) {
        final var optAnn = CommandLine.Option.class.cast(ann);
        cliOpts.add(optAnn.names()[0]);
      } else {
        ann = field.getAnnotation(CommandLine.ArgGroup.class);
        if (ann != null) {
          cliOpts.addAll(getCLIOptionNames(field.getType()));
        }
      }
    }
    return cliOpts;
  }
Return all the option names declared in a class. Note this will recursively check in any inner
option class if present.

@param optClass the class to look for options
@return a list of option names found in the class
app/src/main/java/org/hyperledger/besu/cli/util/CommandLineUtils.java