ErisPulse 1.0.7__tar.gz → 1.0.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import sys
4
4
  import shutil
5
5
  import aiohttp
6
6
  import zipfile
7
+ import fnmatch
7
8
  import asyncio
8
9
  import subprocess
9
10
  import json
@@ -11,6 +12,10 @@ from rich.console import Console
11
12
  from rich.table import Table
12
13
  from rich.panel import Panel
13
14
  from rich.prompt import Prompt, Confirm
15
+ from rich import box
16
+ from prompt_toolkit import PromptSession
17
+ from prompt_toolkit.completion import WordCompleter
18
+ from prompt_toolkit.formatted_text import HTML
14
19
  from .envManager import env
15
20
  from .origin import origin_manager
16
21
 
@@ -19,18 +24,34 @@ console = Console()
19
24
  def enable_module(module_name):
20
25
  module_info = env.get_module(module_name)
21
26
  if module_info:
22
- env.set_module_status(module_name, True)
23
- console.print(f"[green]模块 {module_name} 已启用[/green]")
27
+ with console.status(f"[cyan]正在启用模块 {module_name}...[/cyan]"):
28
+ env.set_module_status(module_name, True)
29
+ console.print(Panel(
30
+ f"[green]✓ 模块 {module_name} 已成功启用[/green]",
31
+ border_style="green"
32
+ ))
24
33
  else:
25
- console.print(f"[red]模块 {module_name} 不存在[/red]")
34
+ console.print(Panel(
35
+ f"[red]模块 {module_name} 不存在[/red]",
36
+ title="错误",
37
+ border_style="red"
38
+ ))
26
39
 
27
40
  def disable_module(module_name):
28
41
  module_info = env.get_module(module_name)
29
42
  if module_info:
30
- env.set_module_status(module_name, False)
31
- console.print(f"[yellow]模块 {module_name} 已禁用[/yellow]")
43
+ with console.status(f"[cyan]正在禁用模块 {module_name}...[/cyan]"):
44
+ env.set_module_status(module_name, False)
45
+ console.print(Panel(
46
+ f"[yellow]✓ 模块 {module_name} 已成功禁用[/yellow]",
47
+ border_style="yellow"
48
+ ))
32
49
  else:
33
- console.print(f"[red]模块 {module_name} 不存在[/red]")
50
+ console.print(Panel(
51
+ f"[red]模块 {module_name} 不存在[/red]",
52
+ title="错误",
53
+ border_style="red"
54
+ ))
34
55
 
35
56
  async def fetch_url(session, url):
36
57
  try:
@@ -114,10 +135,43 @@ def install_pip_dependencies(dependencies):
114
135
  return False
115
136
 
116
137
  def install_module(module_name, force=False):
138
+ # 显示安装摘要
139
+ console.print(Panel.fit(
140
+ f"[bold]准备安装模块:[/bold] [cyan]{module_name}[/cyan]",
141
+ title="安装摘要",
142
+ border_style="blue"
143
+ ))
144
+
145
+ last_update_time = env.get('last_origin_update_time', None)
146
+ if last_update_time:
147
+ from datetime import datetime, timedelta
148
+ last_update = datetime.fromisoformat(last_update_time)
149
+ if datetime.now() - last_update > timedelta(hours=0):
150
+ console.print(Panel(
151
+ "[yellow]距离上次源更新已超过72小时,源内可能有新模块或更新。[/yellow]",
152
+ border_style="yellow"
153
+ ))
154
+ update_confirmation = Confirm.ask(
155
+ "[yellow]是否在安装模块前更新源?[/yellow]",
156
+ default=True
157
+ )
158
+ if update_confirmation:
159
+ with console.status("[cyan]正在更新源...[/cyan]"):
160
+ origin_manager.update_origins()
161
+ env.set('last_origin_update_time', datetime.now().isoformat())
162
+ console.print("[green]✓ 源更新完成[/green]")
163
+
117
164
  module_info = env.get_module(module_name)
118
165
  if module_info and not force:
119
- console.print(f"[yellow]模块 {module_name} 已存在,使用 --force 参数强制重装[/yellow]")
120
- return
166
+ console.print(Panel(
167
+ f"[yellow]模块 {module_name} 已存在[/yellow]\n"
168
+ f"版本: {module_info['info'].get('version', '未知')}\n"
169
+ f"描述: {module_info['info'].get('description', '无描述')}",
170
+ title="模块已存在",
171
+ border_style="yellow"
172
+ ))
173
+ if not Confirm.ask("[yellow]是否要强制重新安装?[/yellow]", default=False):
174
+ return
121
175
 
122
176
  providers = env.get('providers', {})
123
177
  if isinstance(providers, str):
@@ -145,7 +199,15 @@ def install_module(module_name, force=False):
145
199
  })
146
200
 
147
201
  if not module_info:
148
- console.print(f"[red]未找到模块 {module_name}[/red]")
202
+ console.print(Panel(
203
+ f"[red]未找到模块 {module_name}[/red]",
204
+ title="错误",
205
+ border_style="red"
206
+ ))
207
+ if providers:
208
+ console.print("[cyan]当前可用源:[/cyan]")
209
+ for provider in providers:
210
+ console.print(f" - {provider}")
149
211
  return
150
212
 
151
213
  if len(module_info) > 1:
@@ -208,27 +270,65 @@ def install_module(module_name, force=False):
208
270
  console.print(f"[green]模块 {module_name} 安装成功[/green]")
209
271
 
210
272
  def uninstall_module(module_name):
273
+ # 显示卸载摘要
274
+ console.print(Panel.fit(
275
+ f"[bold]准备卸载模块:[/bold] [cyan]{module_name}[/cyan]",
276
+ title="卸载摘要",
277
+ border_style="blue"
278
+ ))
279
+
280
+ module_info = env.get_module(module_name)
281
+ if not module_info:
282
+ console.print(Panel(
283
+ f"[red]模块 {module_name} 不存在[/red]",
284
+ title="错误",
285
+ border_style="red"
286
+ ))
287
+ return
288
+
289
+ # 显示模块信息
290
+ console.print(Panel(
291
+ f"版本: {module_info['info'].get('version', '未知')}\n"
292
+ f"描述: {module_info['info'].get('description', '无描述')}\n"
293
+ f"pip依赖: {', '.join(module_info['info'].get('pip_dependencies', [])) or '无'}",
294
+ title="模块信息",
295
+ border_style="green"
296
+ ))
297
+
298
+ if not Confirm.ask("[red]确认要卸载此模块吗?[/red]", default=False):
299
+ console.print("[yellow]卸载已取消[/yellow]")
300
+ return
301
+
211
302
  script_dir = os.path.dirname(os.path.abspath(__file__))
212
303
  module_path = os.path.join(script_dir, 'modules', module_name)
213
304
 
214
305
  module_file_path = module_path + '.py'
215
306
  if os.path.exists(module_file_path):
216
307
  try:
217
- os.remove(module_file_path)
308
+ with console.status(f"[cyan]正在删除模块文件 {module_name}...[/cyan]"):
309
+ os.remove(module_file_path)
218
310
  except Exception as e:
219
- console.print(f"[red]删除模块文件 {module_name} 时出错: {e}[/red]")
311
+ console.print(Panel(
312
+ f"[red]删除模块文件 {module_name} 时出错: {e}[/red]",
313
+ title="错误",
314
+ border_style="red"
315
+ ))
220
316
  elif os.path.exists(module_path) and os.path.isdir(module_path):
221
317
  try:
222
- shutil.rmtree(module_path)
318
+ with console.status(f"[cyan]正在删除模块目录 {module_name}...[/cyan]"):
319
+ shutil.rmtree(module_path)
223
320
  except Exception as e:
224
- console.print(f"[red]删除模块目录 {module_name} 时出错: {e}[/red]")
321
+ console.print(Panel(
322
+ f"[red]删除模块目录 {module_name} 时出错: {e}[/red]",
323
+ title="错误",
324
+ border_style="red"
325
+ ))
225
326
  else:
226
- console.print(f"[red]模块 {module_name} 不存在[/red]")
227
- return
228
-
229
- module_info = env.get_module(module_name)
230
- if not module_info:
231
- console.print(f"[red]模块 {module_name} 不存在[/red]")
327
+ console.print(Panel(
328
+ f"[red]模块 {module_name} 不存在[/red]",
329
+ title="错误",
330
+ border_style="red"
331
+ ))
232
332
  return
233
333
 
234
334
  pip_dependencies = module_info.get('info', {}).get('pip_dependencies', [])
@@ -252,25 +352,43 @@ def uninstall_module(module_name):
252
352
  unused_pip_dependencies.append(dep)
253
353
 
254
354
  if unused_pip_dependencies:
255
- console.print(f"[cyan]以下 pip 依赖不再被其他模块使用: {', '.join(unused_pip_dependencies)}[/cyan]")
355
+ console.print(Panel(
356
+ f"以下 pip 依赖不再被其他模块使用:\n{', '.join(unused_pip_dependencies)}",
357
+ title="可卸载依赖",
358
+ border_style="cyan"
359
+ ))
256
360
  confirm = Confirm.ask("[yellow]是否卸载这些 pip 依赖?[/yellow]", default=False)
257
361
  if confirm:
258
- console.print(f"[cyan]正在卸载 pip 依赖: {', '.join(unused_pip_dependencies)}[/cyan]")
259
- try:
260
- subprocess.run(
261
- [sys.executable, "-m", "pip", "uninstall", "-y"] + unused_pip_dependencies,
262
- check=True,
263
- stdout=subprocess.PIPE,
264
- stderr=subprocess.PIPE
265
- )
266
- console.print(f"[green]成功卸载 pip 依赖: {', '.join(unused_pip_dependencies)}[/green]")
267
- except subprocess.CalledProcessError as e:
268
- console.print(Panel(f"[red]卸载 pip 依赖失败: {e.stderr.decode()}[/red]", title="错误", border_style="red"))
362
+ with console.status(f"[cyan]正在卸载 pip 依赖: {', '.join(unused_pip_dependencies)}[/cyan]"):
363
+ try:
364
+ subprocess.run(
365
+ [sys.executable, "-m", "pip", "uninstall", "-y"] + unused_pip_dependencies,
366
+ check=True,
367
+ stdout=subprocess.PIPE,
368
+ stderr=subprocess.PIPE
369
+ )
370
+ console.print(Panel(
371
+ f"[green]成功卸载 pip 依赖: {', '.join(unused_pip_dependencies)}[/green]",
372
+ border_style="green"
373
+ ))
374
+ except subprocess.CalledProcessError as e:
375
+ console.print(Panel(
376
+ f"[red]卸载 pip 依赖失败: {e.stderr.decode()}[/red]",
377
+ title="错误",
378
+ border_style="red"
379
+ ))
269
380
 
270
381
  if env.remove_module(module_name):
271
- console.print(f"[green]模块 {module_name} 已删除[/green]")
382
+ console.print(Panel(
383
+ f"[green]✓ 模块 {module_name} 已成功卸载[/green]",
384
+ border_style="green"
385
+ ))
272
386
  else:
273
- console.print(f"[red]模块 {module_name} 不存在[/red]")
387
+ console.print(Panel(
388
+ f"[red]模块 {module_name} 不存在[/red]",
389
+ title="错误",
390
+ border_style="red"
391
+ ))
274
392
  def upgrade_all_modules(force=False):
275
393
  all_modules = env.get_all_modules()
276
394
  if not all_modules:
@@ -345,31 +463,51 @@ def upgrade_all_modules(force=False):
345
463
  def list_modules(module_name=None):
346
464
  all_modules = env.get_all_modules()
347
465
  if not all_modules:
348
- console.print("[yellow]未在数据库中发现注册模块,正在初始化模块列表...[/yellow]")
466
+ console.print(Panel(
467
+ "[yellow]未在数据库中发现注册模块,正在初始化模块列表...[/yellow]",
468
+ border_style="yellow"
469
+ ))
349
470
  from . import init as init_module
350
471
  init_module()
351
472
  all_modules = env.get_all_modules()
352
473
 
353
474
  if not all_modules:
354
- console.print("[red]未找到任何模块[/red]")
475
+ console.print(Panel(
476
+ "[red]未找到任何模块[/red]",
477
+ title="错误",
478
+ border_style="red"
479
+ ))
355
480
  return
356
481
 
357
- table = Table(title="模块列表", show_header=True, header_style="bold magenta")
358
- table.add_column("模块名称", style="cyan")
359
- table.add_column("状态", style="green")
360
- table.add_column("版本", style="blue")
361
- table.add_column("描述", style="white")
362
- table.add_column("依赖", style="yellow")
363
- table.add_column("可选依赖", style="magenta")
364
- table.add_column("pip依赖", style="cyan")
482
+ # 显示模块总数
483
+ console.print(Panel.fit(
484
+ f"[bold]找到 {len(all_modules)} 个模块[/bold]",
485
+ border_style="blue"
486
+ ))
487
+
488
+ table = Table(
489
+ title="模块列表",
490
+ show_header=True,
491
+ header_style="bold magenta",
492
+ expand=True,
493
+ box=box.ROUNDED
494
+ )
495
+ table.add_column("模块名称", style="cyan", min_width=20)
496
+ table.add_column("状态", style="green", justify="center")
497
+ table.add_column("版本", style="blue", justify="center")
498
+ table.add_column("描述", style="white", min_width=30)
499
+ table.add_column("依赖", style="yellow", min_width=15)
500
+ table.add_column("可选依赖", style="magenta", min_width=15)
501
+ table.add_column("pip依赖", style="cyan", min_width=20)
365
502
 
366
503
  for name, info in all_modules.items():
367
- status = "启用" if info.get("status", True) else "禁用"
368
- dependencies = ', '.join(info['info'].get('dependencies', [])) if info['info'].get('dependencies') else '无'
369
- optional_dependencies = ', '.join(info['info'].get('optional_dependencies', [])) if info['info'].get('optional_dependencies') else '无'
370
- pip_dependencies = ', '.join(info['info'].get('pip_dependencies', [])) if info['info'].get('pip_dependencies') else '无'
504
+ status = "[green]✓[/green]" if info.get("status", True) else "[red]✗[/red]"
505
+ dependencies = '\n'.join(info['info'].get('dependencies', [])) if info['info'].get('dependencies') else '无'
506
+ optional_dependencies = '\n'.join(info['info'].get('optional_dependencies', [])) if info['info'].get('optional_dependencies') else '无'
507
+ pip_dependencies = '\n'.join(info['info'].get('pip_dependencies', [])) if info['info'].get('pip_dependencies') else '无'
508
+
371
509
  table.add_row(
372
- name,
510
+ f"[bold]{name}[/bold]",
373
511
  status,
374
512
  info['info'].get('version', '未知'),
375
513
  info['info'].get('description', '无描述'),
@@ -380,19 +518,29 @@ def list_modules(module_name=None):
380
518
 
381
519
  console.print(table)
382
520
 
521
+ # 显示模块状态统计
522
+ enabled_count = sum(1 for m in all_modules.values() if m.get("status", True))
523
+ disabled_count = len(all_modules) - enabled_count
524
+ console.print(Panel(
525
+ f"[green]已启用: {enabled_count}[/green] [red]已禁用: {disabled_count}[/red]",
526
+ title="模块状态统计",
527
+ border_style="blue"
528
+ ))
529
+
383
530
  def main():
384
531
  parser = argparse.ArgumentParser(
385
532
  description="ErisPulse 命令行工具",
386
- prog="python -m ErisPulse"
533
+ prog="ep"
387
534
  )
388
535
  subparsers = parser.add_subparsers(dest='command', help='可用命令')
389
536
 
537
+ # 添加子命令解析器(与原代码一致)
390
538
  enable_parser = subparsers.add_parser('enable', help='启用指定模块')
391
- enable_parser.add_argument('module_name', type=str, help='要启用的模块名称')
539
+ enable_parser.add_argument('module_names', nargs='+', help='要启用的模块名称(支持多个模块,用空格分隔)')
392
540
  enable_parser.add_argument('--init', action='store_true', help='在启用模块前初始化模块数据库')
393
541
 
394
542
  disable_parser = subparsers.add_parser('disable', help='禁用指定模块')
395
- disable_parser.add_argument('module_name', type=str, help='要禁用的模块名称')
543
+ disable_parser.add_argument('module_names', nargs='+', help='要禁用的模块名称(支持多个模块,用空格分隔)')
396
544
  disable_parser.add_argument('--init', action='store_true', help='在禁用模块前初始化模块数据库')
397
545
 
398
546
  list_parser = subparsers.add_parser('list', help='列出所有模块信息')
@@ -404,10 +552,10 @@ def main():
404
552
  upgrade_parser.add_argument('--force', action='store_true', help='跳过二次确认,强制更新')
405
553
 
406
554
  uninstall_parser = subparsers.add_parser('uninstall', help='删除指定模块')
407
- uninstall_parser.add_argument('module_name', type=str, help='要删除的模块名称')
555
+ uninstall_parser.add_argument('module_names', nargs='+', help='要卸载的模块名称(支持多个模块,用空格分隔)')
408
556
 
409
- install_parser = subparsers.add_parser('install', help='安装指定模块(支持多个模块,用逗号分隔)')
410
- install_parser.add_argument('module_name', type=str, help='要安装的模块名称')
557
+ install_parser = subparsers.add_parser('install', help='安装指定模块(支持多个模块,用空格分隔)')
558
+ install_parser.add_argument('module_name', nargs='+', help='要安装的模块名称(支持多个模块,用空格分隔)')
411
559
  install_parser.add_argument('--force', action='store_true', help='强制重新安装模块')
412
560
  install_parser.add_argument('--init', action='store_true', help='在安装模块前初始化模块数据库')
413
561
 
@@ -424,25 +572,132 @@ def main():
424
572
 
425
573
  args = parser.parse_args()
426
574
 
575
+ # 初始化模块数据库
427
576
  if hasattr(args, 'init') and args.init:
428
577
  console.print("[yellow]正在初始化模块列表...[/yellow]")
429
578
  from . import init as init_module
430
579
  init_module()
431
580
 
432
- # 全部指令:enable, disable, list, uninstall, install, update, origin(add, list, del)
433
581
  if args.command == 'enable':
434
- enable_module(args.module_name)
582
+ for module_name in args.module_names:
583
+ module_name = module_name.strip()
584
+ if not module_name:
585
+ continue
586
+ if '*' in module_name or '?' in module_name:
587
+ console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
588
+ all_modules = env.get_all_modules()
589
+ if not all_modules:
590
+ console.print(Panel("[red]未找到任何模块,请先更新源或检查配置[/red]", title="错误", border_style="red"))
591
+ continue
592
+ matched_modules = [name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)]
593
+ if not matched_modules:
594
+ console.print(Panel(f"[red]未找到匹配模块模式 {module_name} 的模块[/red]", title="错误", border_style="red"))
595
+ continue
596
+ console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
597
+ for i, matched_module in enumerate(matched_modules, start=1):
598
+ console.print(f" {i}. {matched_module}")
599
+ confirm = Confirm.ask("[yellow]是否启用所有匹配模块?[/yellow]", default=True)
600
+ if not confirm:
601
+ console.print("[yellow]操作已取消[/yellow]")
602
+ continue
603
+ for matched_module in matched_modules:
604
+ enable_module(matched_module)
605
+ else:
606
+ enable_module(module_name)
435
607
  elif args.command == 'disable':
436
- disable_module(args.module_name)
608
+ for module_name in args.module_names:
609
+ module_name = module_name.strip()
610
+ if not module_name:
611
+ continue
612
+ if '*' in module_name or '?' in module_name:
613
+ console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
614
+ all_modules = env.get_all_modules()
615
+ if not all_modules:
616
+ console.print(Panel("[red]未找到任何模块,请先更新源或检查配置[/red]", title="错误", border_style="red"))
617
+ continue
618
+ matched_modules = [name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)]
619
+ if not matched_modules:
620
+ console.print(Panel(f"[red]未找到匹配模块模式 {module_name} 的模块[/red]", title="错误", border_style="red"))
621
+ continue
622
+ console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
623
+ for i, matched_module in enumerate(matched_modules, start=1):
624
+ console.print(f" {i}. {matched_module}")
625
+ confirm = Confirm.ask("[yellow]是否禁用所有匹配模块?[/yellow]", default=True)
626
+ if not confirm:
627
+ console.print("[yellow]操作已取消[/yellow]")
628
+ continue
629
+ for matched_module in matched_modules:
630
+ disable_module(matched_module)
631
+ else:
632
+ disable_module(module_name)
437
633
  elif args.command == 'list':
438
634
  list_modules(args.module)
439
635
  elif args.command == 'uninstall':
440
- uninstall_module(args.module_name)
636
+ for module_name in args.module_names:
637
+ module_name = module_name.strip()
638
+ if not module_name:
639
+ continue
640
+ if '*' in module_name or '?' in module_name:
641
+ console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
642
+ all_modules = env.get_all_modules()
643
+ if not all_modules:
644
+ console.print(Panel("[red]未找到任何模块,请先更新源或检查配置[/red]", title="错误", border_style="red"))
645
+ continue
646
+ matched_modules = [name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)]
647
+ if not matched_modules:
648
+ console.print(Panel(f"[red]未找到匹配模块模式 {module_name} 的模块[/red]", title="错误", border_style="red"))
649
+ continue
650
+ console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
651
+ for i, matched_module in enumerate(matched_modules, start=1):
652
+ console.print(f" {i}. {matched_module}")
653
+ confirm = Confirm.ask("[yellow]是否卸载所有匹配模块?[/yellow]", default=True)
654
+ if not confirm:
655
+ console.print("[yellow]操作已取消[/yellow]")
656
+ continue
657
+ for matched_module in matched_modules:
658
+ uninstall_module(matched_module)
659
+ else:
660
+ uninstall_module(module_name)
441
661
  elif args.command == 'install':
442
- module_names = args.module_name.split(',')
443
- for module_name in module_names:
662
+ for module_name in args.module_name:
444
663
  module_name = module_name.strip()
445
- if module_name:
664
+ if not module_name:
665
+ continue
666
+ if '*' in module_name or '?' in module_name:
667
+ console.print(f"[cyan]正在匹配模块模式: {module_name}...[/cyan]")
668
+ all_modules = env.get_all_modules()
669
+ if not all_modules:
670
+ console.print(Panel(
671
+ "[red]未找到任何模块,请先更新源或检查配置[/red]",
672
+ title="错误",
673
+ border_style="red"
674
+ ))
675
+ continue
676
+
677
+ matched_modules = [
678
+ name for name in all_modules.keys() if fnmatch.fnmatch(name, module_name)
679
+ ]
680
+
681
+ if not matched_modules:
682
+ console.print(Panel(
683
+ f"[red]未找到匹配模块模式 {module_name} 的模块[/red]",
684
+ title="错误",
685
+ border_style="red"
686
+ ))
687
+ continue
688
+
689
+ console.print(f"[green]找到 {len(matched_modules)} 个匹配模块:[/green]")
690
+ for i, matched_module in enumerate(matched_modules, start=1):
691
+ console.print(f" {i}. {matched_module}")
692
+
693
+ confirm = Confirm.ask("[yellow]是否安装所有匹配模块?[/yellow]", default=True)
694
+ if not confirm:
695
+ console.print("[yellow]安装已取消[/yellow]")
696
+ continue
697
+
698
+ for matched_module in matched_modules:
699
+ install_module(matched_module, args.force)
700
+ else:
446
701
  install_module(module_name, args.force)
447
702
  elif args.command == 'update':
448
703
  origin_manager.update_origins()
@@ -450,7 +705,11 @@ def main():
450
705
  upgrade_all_modules(args.force)
451
706
  elif args.command == 'origin':
452
707
  if args.origin_command == 'add':
453
- origin_manager.add_origin(args.url)
708
+ success = origin_manager.add_origin(args.url)
709
+ if success:
710
+ update_confirmation = Confirm.ask("[yellow]源已添加,是否立即更新源以获取最新模块信息?[/yellow]", default=True)
711
+ if update_confirmation:
712
+ origin_manager.update_origins()
454
713
  elif args.origin_command == 'list':
455
714
  origin_manager.list_origins()
456
715
  elif args.origin_command == 'del':
@@ -461,4 +720,4 @@ def main():
461
720
  parser.print_help()
462
721
 
463
722
  if __name__ == "__main__":
464
- main()
723
+ main()
@@ -39,15 +39,17 @@ class OriginManager:
39
39
  validated_url = asyncio.run(self._validate_url(value))
40
40
  if not validated_url:
41
41
  print("提供的源不是一个有效源,请检查后重试。")
42
- return
42
+ return False
43
43
 
44
44
  origins = env.get('origins')
45
45
  if validated_url not in origins:
46
46
  origins.append(validated_url)
47
47
  env.set('origins', origins)
48
48
  print(f"源 {validated_url} 已成功添加。")
49
+ return True
49
50
  else:
50
51
  print(f"源 {validated_url} 已存在,无需重复添加。")
52
+ return False
51
53
 
52
54
  def update_origins(self):
53
55
  origins = env.get('origins')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Home-page: https://github.com/wsu2059q/ErisPulse
6
6
  Author: 艾莉丝·格雷拉特(WSu2059)
@@ -25,6 +25,7 @@ Requires-Python: >=3.7
25
25
  Description-Content-Type: text/markdown
26
26
  Requires-Dist: aiohttp
27
27
  Requires-Dist: rich
28
+ Requires-Dist: prompt_toolkit
28
29
  Dynamic: author
29
30
  Dynamic: author-email
30
31
  Dynamic: classifier
@@ -56,3 +57,9 @@ ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用
56
57
 
57
58
  ## 1.0.7
58
59
  修复诸多小问题
60
+
61
+ ## 1.0.8
62
+ 现在包会被添加至系统环境,用户可以直接通过命令行'ep'或'epsdk'命令调用cli
63
+
64
+ ## 1.0.9
65
+ 修复了部分命令行参数的错误
@@ -11,5 +11,6 @@ ErisPulse/util.py
11
11
  ErisPulse.egg-info/PKG-INFO
12
12
  ErisPulse.egg-info/SOURCES.txt
13
13
  ErisPulse.egg-info/dependency_links.txt
14
+ ErisPulse.egg-info/entry_points.txt
14
15
  ErisPulse.egg-info/requires.txt
15
16
  ErisPulse.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ ep = ErisPulse.__main__:main
3
+ epsdk = ErisPulse.__main__:main
@@ -0,0 +1,3 @@
1
+ aiohttp
2
+ rich
3
+ prompt_toolkit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Home-page: https://github.com/wsu2059q/ErisPulse
6
6
  Author: 艾莉丝·格雷拉特(WSu2059)
@@ -25,6 +25,7 @@ Requires-Python: >=3.7
25
25
  Description-Content-Type: text/markdown
26
26
  Requires-Dist: aiohttp
27
27
  Requires-Dist: rich
28
+ Requires-Dist: prompt_toolkit
28
29
  Dynamic: author
29
30
  Dynamic: author-email
30
31
  Dynamic: classifier
@@ -56,3 +57,9 @@ ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用
56
57
 
57
58
  ## 1.0.7
58
59
  修复诸多小问题
60
+
61
+ ## 1.0.8
62
+ 现在包会被添加至系统环境,用户可以直接通过命令行'ep'或'epsdk'命令调用cli
63
+
64
+ ## 1.0.9
65
+ 修复了部分命令行参数的错误
@@ -15,4 +15,10 @@ ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用
15
15
  修复了SDK-CLI中的颜色乱码问题,并将db调整为包内存储,以解决多进程问题
16
16
 
17
17
  ## 1.0.7
18
- 修复诸多小问题
18
+ 修复诸多小问题
19
+
20
+ ## 1.0.8
21
+ 现在包会被添加至系统环境,用户可以直接通过命令行'ep'或'epsdk'命令调用cli
22
+
23
+ ## 1.0.9
24
+ 修复了部分命令行参数的错误
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ErisPulse',
5
- version='1.0.7',
5
+ version='1.0.9',
6
6
  author='艾莉丝·格雷拉特(WSu2059)',
7
7
  author_email='wsu2059@qq.com',
8
8
  maintainer='runoneall',
@@ -12,7 +12,7 @@ setup(
12
12
  long_description_content_type='text/markdown',
13
13
  url='https://github.com/wsu2059q/ErisPulse',
14
14
  packages=find_packages(),
15
- install_requires=["aiohttp", "rich"],
15
+ install_requires=["aiohttp", "rich","prompt_toolkit"],
16
16
  license='MIT',
17
17
  classifiers=[
18
18
  'Development Status :: 5 - Production/Stable',
@@ -25,9 +25,15 @@ setup(
25
25
  'Programming Language :: Python :: 3.10',
26
26
  'Programming Language :: Python :: 3.11',
27
27
  'Programming Language :: Python :: 3.12',
28
- 'Programming Language :: Python :: 3 :: Only', # 仅支持 Python 3
28
+ 'Programming Language :: Python :: 3 :: Only',
29
29
  'Operating System :: OS Independent',
30
30
  'Topic :: Software Development :: Libraries :: Python Modules',
31
31
  ],
32
+ entry_points={
33
+ "console_scripts": [
34
+ "epsdk=ErisPulse.__main__:main",
35
+ "ep=ErisPulse.__main__:main"
36
+ ]
37
+ },
32
38
  python_requires='>=3.7',
33
- )
39
+ )
@@ -1,2 +0,0 @@
1
- aiohttp
2
- rich
File without changes
File without changes
File without changes
File without changes
File without changes