feat: core-config -> core config
This commit is contained in:
@ -55,31 +55,6 @@ def create_parser() -> argparse.ArgumentParser:
|
||||
# Storage info command
|
||||
storage_parser = subscription_subparsers.add_parser('storage', help='Show storage information')
|
||||
|
||||
# Core config commands
|
||||
core_config_parser = subparsers.add_parser('core-config', help='Manage core configuration')
|
||||
core_config_subparsers = core_config_parser.add_subparsers(dest='core_config_command', help='Configuration operations')
|
||||
|
||||
# Import config
|
||||
import_parser = core_config_subparsers.add_parser('import', help='Import configuration from file')
|
||||
import_parser.add_argument('source', help='Path to configuration file to import')
|
||||
|
||||
# Export config
|
||||
export_parser = core_config_subparsers.add_parser('export', help='Export configuration to file')
|
||||
export_parser.add_argument('destination', help='Path to save configuration file')
|
||||
|
||||
# Edit config
|
||||
edit_parser = core_config_subparsers.add_parser('edit', help='Edit configuration with system editor')
|
||||
|
||||
# Reset config
|
||||
reset_parser = core_config_subparsers.add_parser('reset', help='Reset configuration to default values')
|
||||
|
||||
# Show config
|
||||
show_parser = core_config_subparsers.add_parser('show', help='Show current configuration')
|
||||
|
||||
# Apply config
|
||||
apply_parser = core_config_subparsers.add_parser('apply', help='Apply active subscription to generate final config')
|
||||
|
||||
|
||||
# Core commands
|
||||
core_parser = subparsers.add_parser('core', help='Manage scientific-surfing core components')
|
||||
core_subparsers = core_parser.add_subparsers(dest='core_command', help='Core operations')
|
||||
@ -89,6 +64,30 @@ def create_parser() -> argparse.ArgumentParser:
|
||||
update_parser.add_argument('--version', help='Specific version to download (e.g., v1.18.5). If not specified, downloads latest')
|
||||
update_parser.add_argument('--force', action='store_true', help='Force update even if binary already exists')
|
||||
|
||||
# Config commands
|
||||
config_parser = core_subparsers.add_parser('config', help='Manage core configuration')
|
||||
config_subparsers = config_parser.add_subparsers(dest='config_command', help='Configuration operations')
|
||||
|
||||
# Import config
|
||||
import_parser = config_subparsers.add_parser('import', help='Import configuration from file')
|
||||
import_parser.add_argument('source', help='Path to configuration file to import')
|
||||
|
||||
# Export config
|
||||
export_parser = config_subparsers.add_parser('export', help='Export configuration to file')
|
||||
export_parser.add_argument('destination', help='Path to save configuration file')
|
||||
|
||||
# Edit config
|
||||
edit_parser = config_subparsers.add_parser('edit', help='Edit configuration with system editor')
|
||||
|
||||
# Reset config
|
||||
reset_parser = config_subparsers.add_parser('reset', help='Reset configuration to default values')
|
||||
|
||||
# Show config
|
||||
show_parser = config_subparsers.add_parser('show', help='Show current configuration')
|
||||
|
||||
# Apply config
|
||||
apply_parser = config_subparsers.add_parser('apply', help='Apply active subscription to generate final config')
|
||||
|
||||
# Service management commands
|
||||
service_parser = core_subparsers.add_parser('service', help='Manage mihomo as a system service')
|
||||
service_subparsers = service_parser.add_subparsers(dest='service_command', help='Service operations')
|
||||
@ -180,27 +179,6 @@ def main() -> None:
|
||||
else:
|
||||
parser.parse_args(['subscription', '--help'])
|
||||
|
||||
elif args.command == 'core-config':
|
||||
if not hasattr(args, 'core_config_command') or not args.core_config_command:
|
||||
parser.parse_args(['core-config', '--help'])
|
||||
return
|
||||
|
||||
|
||||
if args.core_config_command == 'import':
|
||||
core_config_manager.import_config(args.source)
|
||||
elif args.core_config_command == 'export':
|
||||
core_config_manager.export_config(args.destination)
|
||||
elif args.core_config_command == 'edit':
|
||||
core_config_manager.edit_config()
|
||||
elif args.core_config_command == 'reset':
|
||||
core_config_manager.reset_config()
|
||||
elif args.core_config_command == 'show':
|
||||
core_config_manager.show_config()
|
||||
elif args.core_config_command == 'apply':
|
||||
core_config_manager.apply()
|
||||
else:
|
||||
parser.parse_args(['core-config', '--help'])
|
||||
|
||||
elif args.command == 'core':
|
||||
if not hasattr(args, 'core_command') or not args.core_command:
|
||||
parser.parse_args(['core', '--help'])
|
||||
@ -208,6 +186,25 @@ def main() -> None:
|
||||
|
||||
if args.core_command == 'update':
|
||||
core_manager.update(version=args.version, force=args.force)
|
||||
elif args.core_command == 'config':
|
||||
if not hasattr(args, 'config_command') or not args.config_command:
|
||||
parser.parse_args(['core', 'config', '--help'])
|
||||
return
|
||||
|
||||
if args.config_command == 'import':
|
||||
core_config_manager.import_config(args.source)
|
||||
elif args.config_command == 'export':
|
||||
core_config_manager.export_config(args.destination)
|
||||
elif args.config_command == 'edit':
|
||||
core_config_manager.edit_config()
|
||||
elif args.config_command == 'reset':
|
||||
core_config_manager.reset_config()
|
||||
elif args.config_command == 'show':
|
||||
core_config_manager.show_config()
|
||||
elif args.config_command == 'apply':
|
||||
core_config_manager.apply()
|
||||
else:
|
||||
parser.parse_args(['core', 'config', '--help'])
|
||||
elif args.core_command == 'service':
|
||||
if not hasattr(args, 'service_command') or not args.service_command:
|
||||
parser.parse_args(['core', 'service', '--help'])
|
||||
|
||||
Reference in New Issue
Block a user