MCPcopy Create free account
hub / github.com/FastLED/FastLED / create_argument_parser

Function create_argument_parser

ci/tools/led_timing_conversions.py:621–682  ·  view source on GitHub ↗

Create and configure argument parser. Returns: Configured ArgumentParser instance

()

Source from the content-addressed store, hash-verified

619
620
621def create_argument_parser() -> argparse.ArgumentParser:
622 """Create and configure argument parser.
623
624 Returns:
625 Configured ArgumentParser instance
626 """
627 parser = argparse.ArgumentParser(
628 description="LED Chipset Timing Conversion Tool",
629 formatter_class=argparse.RawDescriptionHelpFormatter,
630 epilog="""
631Examples:
632 # Interactive mode (default if no arguments provided)
633 python led_timing_conversions.py
634 python led_timing_conversions.py --interactive
635
636 # Convert from datasheet format to 3-phase format
637 python led_timing_conversions.py --datasheet 400 850 850 400
638
639 # Convert from 3-phase format to datasheet format
640 python led_timing_conversions.py --fastled 250 625 375
641
642 # Verbose output with C++ definition
643 python led_timing_conversions.py --datasheet 400 850 850 400 --verbose
644""",
645 )
646
647 # Create mutually exclusive group for operation modes
648 mode_group = parser.add_mutually_exclusive_group(required=False)
649
650 mode_group.add_argument(
651 "-i",
652 "--interactive",
653 action="store_true",
654 help="Run in interactive mode (default if no mode specified)",
655 )
656
657 mode_group.add_argument(
658 "-d",
659 "--datasheet",
660 nargs=4,
661 type=int,
662 metavar=("T0H", "T0L", "T1H", "T1L"),
663 help="Convert from datasheet format (T0H T0L T1H T1L in nanoseconds)",
664 )
665
666 mode_group.add_argument(
667 "-f",
668 "--fastled",
669 nargs=3,
670 type=int,
671 metavar=("T1", "T2", "T3"),
672 help="Convert from 3-phase format (T1 T2 T3 in nanoseconds)",
673 )
674
675 parser.add_argument(
676 "-v",
677 "--verbose",
678 action="store_true",

Callers 1

parse_argumentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected