Coverage for src/cli.py: 78%

1"""CLI 入口."""

2

3 import typer

4 from rich.console import Console

5

6 app = typer.Typer(help="GEO-SEO Optimizer CLI")

7 console = Console()

8

9

10@app.command()

11 def keywords(

12 action: str = typer.Argument(...),

13 query: str = typer.Argument(...),

14 output: str = typer.Option(None, "--output", "-o"),

15) -> None:

16 """关键词研究命令."""

17 console.print(f"[green]关键词研究: {query}[/green]")

18

19

20@app.command()

21 def content(

22 action: str = typer.Argument(...),

23 source: str = typer.Argument(...),

24 platform: str = typer.Option(None, "--platform", "-p"),

25 seo: bool = typer.Option(True, "--seo/--no-seo"),

26 geo: bool = typer.Option(True, "--geo/--no-geo"),

27) -> None:

28 """内容生成命令."""

29 console.print(f"[green]内容生成: {source}[/green]")

30

31

32@app.command()

33 def adapt(

34 content_file: str = typer.Argument(...),

35 platform: str = typer.Option(..., "--platform", "-p"),

36 output: str = typer.Option(None, "--output", "-o"),

37) -> None:

38 """平台适配命令."""

39 console.print(f"[green]适配到 {platform}[/green]")

40

41

42@app.command()

43 def analytics(

44 action: str = typer.Argument(...),

45 target: str = typer.Argument(None),

46 days: int = typer.Option(30, "--days", "-d"),

47) -> None:

48 """分析命令."""

49 console.print(f"[green]分析: {action}[/green]")

50

51

52 def main() -> None:

53 app()

54

55

56 if __name__ == "__main__":

57 main()