-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (24 loc) · 802 Bytes
/
main.py
File metadata and controls
35 lines (24 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import click
from rich.console import Console
from cli import user, search, search_historical, interactive, refresh_session
console = Console()
@click.group()
@click.option('--config', '-c', default='config.ini', help='Configuration file path')
@click.pass_context
def cli(ctx: click.Context, config: str) -> None:
ctx.ensure_object(dict)
ctx.obj['config'] = config
cli.add_command(user)
cli.add_command(search)
cli.add_command(search_historical)
cli.add_command(interactive)
cli.add_command(refresh_session)
def main() -> None:
try:
cli()
except KeyboardInterrupt:
console.print("\n[yellow]Operation cancelled by user[/yellow]")
except Exception as e:
console.print(f"[red]Unexpected error: {str(e)}[/red]")
if __name__ == "__main__":
main()