|
57 | 57 | )
|
58 | 58 |
|
59 | 59 |
|
| 60 | +# Some command line flags can be set through environment |
| 61 | +def environment_setting(name: str, default: Optional[str]) -> str: |
| 62 | + return os.environ.get(f"ESP8266_ARDUINO_MKBUILDOPTGLOBALS_{name}", default or "") |
| 63 | + |
| 64 | + |
| 65 | +def is_true(v: str) -> bool: |
| 66 | + return v.lower() in ("y", "yes", "1", "true", "on") |
| 67 | + |
| 68 | + |
| 69 | +DEFAULT_DEBUG = is_true(environment_setting("DEBUG", "n")) |
| 70 | +DEFAULT_AUDIT = is_true(environment_setting("AUDIT", "n")) |
| 71 | + |
60 | 72 | # Like existing documentation methods, signature is embedded in the comment block
|
61 | 73 | # Unlike existing documentation methods, only the first line contains any metadata
|
62 | 74 |
|
@@ -618,10 +630,16 @@ def main_help(args: argparse.Namespace):
|
618 | 630 | parser.set_defaults(func=main_help)
|
619 | 631 |
|
620 | 632 | parser.add_argument(
|
621 | | - "--debug", action="store_true", help=argparse.SUPPRESS |
| 633 | + "--debug", |
| 634 | + action="store_true", |
| 635 | + help=argparse.SUPPRESS, |
| 636 | + default=DEFAULT_DEBUG, |
622 | 637 | ) # normal debug
|
623 | 638 | parser.add_argument(
|
624 | | - "--audit", action="store_true", help=argparse.SUPPRESS |
| 639 | + "--audit", |
| 640 | + action="store_true", |
| 641 | + help=argparse.SUPPRESS, |
| 642 | + default=DEFAULT_AUDIT, |
625 | 643 | ) # extra noisy debug
|
626 | 644 |
|
627 | 645 | parser.add_argument(
|
|
0 commit comments