parseArgs static method

PigeonOptions parseArgs(
  1. List<String> args
)

Convert command-line arguments to PigeonOptions.

Implementation

static PigeonOptions parseArgs(List<String> args) {
  // Note: This function shouldn't perform any logic, just translate the args
  // to PigeonOptions.  Synthesized values inside of the PigeonOption should
  // get set in the `run` function to accommodate users that are using the
  // `configurePigeon` function.
  final ArgResults results = _argParser.parse(args);

  final PigeonOptions opts = PigeonOptions(
    input: results['input'] as String?,
    dartOut: results['dart_out'] as String?,
    dartTestOut: results['dart_test_out'] as String?,
    objcHeaderOut: results['objc_header_out'] as String?,
    objcSourceOut: results['objc_source_out'] as String?,
    objcOptions: ObjcOptions(
      prefix: results['objc_prefix'] as String?,
    ),
    javaOut: results['java_out'] as String?,
    javaOptions: JavaOptions(
      package: results['java_package'] as String?,
      useGeneratedAnnotation:
          results['java_use_generated_annotation'] as bool?,
    ),
    swiftOut: results['swift_out'] as String?,
    kotlinOut: results['kotlin_out'] as String?,
    kotlinOptions: KotlinOptions(
      package: results['kotlin_package'] as String?,
    ),
    cppHeaderOut: results['cpp_header_out'] as String?,
    cppSourceOut: results['cpp_source_out'] as String?,
    cppOptions: CppOptions(
      namespace: results['cpp_namespace'] as String?,
    ),
    copyrightHeader: results['copyright_header'] as String?,
    oneLanguage: results['one_language'] as bool?,
    astOut: results['ast_out'] as String?,
    debugGenerators: results['debug_generators'] as bool?,
    basePath: results['base_path'] as String?,
    dartPackageName: results['package_name'] as String?,
  );
  return opts;
}