|
49 | 49 | import logging |
50 | 50 | import os |
51 | 51 | from pathlib import Path |
| 52 | +from typing import Optional |
52 | 53 |
|
53 | 54 | import click |
54 | 55 | import toml |
@@ -130,7 +131,7 @@ def config_extended(): |
130 | 131 | help="Specific model to generate schema for (e.g., Config, NetworkConfig)", |
131 | 132 | ) |
132 | 133 | @click.option("--output", "-o", type=click.Path(), help="Output file path") |
133 | | -def schema_cmd(format_: str, model: str | None, output: str | None): |
| 134 | +def schema_cmd(format_: str, model: Optional[str], output: Optional[str]): |
134 | 135 | """Generate JSON schema for configuration models.""" |
135 | 136 | try: |
136 | 137 | if model: |
@@ -209,10 +210,10 @@ def schema_cmd(format_: str, model: str | None, output: str | None): |
209 | 210 | def template_cmd( |
210 | 211 | template_name: str, |
211 | 212 | apply: bool, |
212 | | - output: str | None, |
213 | | - config_file: str | None, |
214 | | - restart_daemon_flag: bool | None, |
215 | | - no_restart_daemon_flag: bool | None, |
| 213 | + output: Optional[str], |
| 214 | + config_file: Optional[str], |
| 215 | + restart_daemon_flag: Optional[bool], |
| 216 | + no_restart_daemon_flag: Optional[bool], |
216 | 217 | ): |
217 | 218 | """Manage configuration templates.""" |
218 | 219 | try: |
@@ -333,10 +334,10 @@ def template_cmd( |
333 | 334 | def profile_cmd( |
334 | 335 | profile_name: str, |
335 | 336 | apply: bool, |
336 | | - output: str | None, |
337 | | - config_file: str | None, |
338 | | - restart_daemon_flag: bool | None, |
339 | | - no_restart_daemon_flag: bool | None, |
| 337 | + output: Optional[str], |
| 338 | + config_file: Optional[str], |
| 339 | + restart_daemon_flag: Optional[bool], |
| 340 | + no_restart_daemon_flag: Optional[bool], |
340 | 341 | ): |
341 | 342 | """Manage configuration profiles.""" |
342 | 343 | try: |
@@ -448,7 +449,7 @@ def profile_cmd( |
448 | 449 | help="Compress backup", |
449 | 450 | ) |
450 | 451 | @click.option("--config", "config_file", type=click.Path(exists=True), default=None) |
451 | | -def backup_cmd(description: str, compress: bool, config_file: str | None): |
| 452 | +def backup_cmd(description: str, compress: bool, config_file: Optional[str]): |
452 | 453 | """Create configuration backup.""" |
453 | 454 | try: |
454 | 455 | cm = ConfigManager(config_file) |
@@ -488,7 +489,7 @@ def backup_cmd(description: str, compress: bool, config_file: str | None): |
488 | 489 | help="Skip confirmation prompt", |
489 | 490 | ) |
490 | 491 | @click.option("--config", "config_file", type=click.Path(), default=None) |
491 | | -def restore_cmd(backup_file: str, confirm: bool, config_file: str | None): |
| 492 | +def restore_cmd(backup_file: str, confirm: bool, config_file: Optional[str]): |
492 | 493 | """Restore configuration from backup.""" |
493 | 494 | try: |
494 | 495 | if not confirm: |
@@ -578,7 +579,7 @@ def list_backups_cmd(format_: str): |
578 | 579 | type=click.Path(), |
579 | 580 | help="Output file path", |
580 | 581 | ) |
581 | | -def diff_cmd(config1: str, config2: str, format_: str, output: str | None): |
| 582 | +def diff_cmd(config1: str, config2: str, format_: str, output: Optional[str]): |
582 | 583 | """Compare two configuration files.""" |
583 | 584 | try: |
584 | 585 | # ConfigDiff instance is not required; use classmethod compare_files |
@@ -696,10 +697,10 @@ def capabilities_summary_cmd(): |
696 | 697 | ) |
697 | 698 | def auto_tune_cmd( |
698 | 699 | apply: bool, |
699 | | - output: str | None, |
700 | | - config_file: str | None, |
701 | | - restart_daemon_flag: bool | None, |
702 | | - no_restart_daemon_flag: bool | None, |
| 700 | + output: Optional[str], |
| 701 | + config_file: Optional[str], |
| 702 | + restart_daemon_flag: Optional[bool], |
| 703 | + no_restart_daemon_flag: Optional[bool], |
703 | 704 | ): |
704 | 705 | """Auto-tune configuration based on system capabilities.""" |
705 | 706 | try: |
@@ -792,7 +793,7 @@ def auto_tune_cmd( |
792 | 793 | help="Output file path", |
793 | 794 | ) |
794 | 795 | @click.option("--config", "config_file", type=click.Path(exists=True), default=None) |
795 | | -def export_cmd(format_: str, output: str, config_file: str | None): |
| 796 | +def export_cmd(format_: str, output: str, config_file: Optional[str]): |
796 | 797 | """Export configuration to file.""" |
797 | 798 | try: |
798 | 799 | cm = ConfigManager(config_file) |
@@ -857,11 +858,11 @@ def export_cmd(format_: str, output: str, config_file: str | None): |
857 | 858 | ) |
858 | 859 | def import_cmd( |
859 | 860 | import_file: str, |
860 | | - format_: str | None, |
861 | | - output: str | None, |
862 | | - config_file: str | None, |
863 | | - restart_daemon_flag: bool | None, |
864 | | - no_restart_daemon_flag: bool | None, |
| 861 | + format_: Optional[str], |
| 862 | + output: Optional[str], |
| 863 | + config_file: Optional[str], |
| 864 | + restart_daemon_flag: Optional[bool], |
| 865 | + no_restart_daemon_flag: Optional[bool], |
865 | 866 | ): |
866 | 867 | """Import configuration from file.""" |
867 | 868 | try: |
@@ -967,7 +968,7 @@ def import_cmd( |
967 | 968 | is_flag=True, |
968 | 969 | help="Show detailed validation results", |
969 | 970 | ) |
970 | | -def validate_cmd(config_file: str | None, detailed: bool): |
| 971 | +def validate_cmd(config_file: Optional[str], detailed: bool): |
971 | 972 | """Validate configuration file.""" |
972 | 973 | try: |
973 | 974 | cm = ConfigManager(config_file) |
|
0 commit comments