MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / Options

Function Options

BaseTools/Source/Python/Trim/Trim.py:435–488  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

433# @retval InputFile Path of file to be trimmed
434#
435def Options():
436 OptionList = [
437 make_option("-s", "--source-code", dest="FileType", const="SourceCode", action="store_const",
438 help="The input file is preprocessed source code, including C or assembly code"),
439 make_option("-r", "--vfr-file", dest="FileType", const="Vfr", action="store_const",
440 help="The input file is preprocessed VFR file"),
441 make_option("--Vfr-Uni-Offset", dest="FileType", const="VfrOffsetBin", action="store_const",
442 help="The input file is EFI image"),
443 make_option("-a", "--asl-file", dest="FileType", const="Asl", action="store_const",
444 help="The input file is ASL file"),
445 make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true",
446 help="Convert standard hex format (0xabcd) to MASM format (abcdh)"),
447
448 make_option("-l", "--trim-long", dest="TrimLong", action="store_true",
449 help="Remove postfix of long number"),
450 make_option("-i", "--include-path-file", dest="IncludePathFile",
451 help="The input file is include path list to search for ASL include file"),
452 make_option("-o", "--output", dest="OutputFile",
453 help="File to store the trimmed content"),
454 make_option("--ModuleName", dest="ModuleName", help="The module's BASE_NAME"),
455 make_option("--DebugDir", dest="DebugDir",
456 help="Debug Output directory to store the output files"),
457 make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
458 help="Run verbosely"),
459 make_option("-d", "--debug", dest="LogLevel", type="int",
460 help="Run with debug information"),
461 make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET,
462 help="Run quietly"),
463 make_option("-?", action="help", help="show this help message and exit"),
464 ]
465
466 # use clearer usage to override default usage message
467 UsageString = "%prog [-s|-r|-a|--Vfr-Uni-Offset] [-c] [-v|-d <debug_level>|-q] [-i <include_path_file>] [-o <output_file>] [--ModuleName <ModuleName>] [--DebugDir <DebugDir>] [<input_file>]"
468
469 Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString)
470 Parser.set_defaults(FileType="Vfr")
471 Parser.set_defaults(ConvertHex=False)
472 Parser.set_defaults(LogLevel=EdkLogger.INFO)
473
474 Options, Args = Parser.parse_args()
475
476 # error check
477 if Options.FileType == 'VfrOffsetBin':
478 if len(Args) == 0:
479 return Options, ''
480 elif len(Args) > 1:
481 EdkLogger.error("Trim", OPTION_NOT_SUPPORTED, ExtraData=Parser.get_usage())
482 if len(Args) == 0:
483 EdkLogger.error("Trim", OPTION_MISSING, ExtraData=Parser.get_usage())
484 if len(Args) > 1:
485 EdkLogger.error("Trim", OPTION_NOT_SUPPORTED, ExtraData=Parser.get_usage())
486
487 InputFile = Args[0]
488 return Options, InputFile
489
490## Entrance method
491#

Callers 1

MainFunction · 0.70

Calls 2

lenFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected