starbash 0.1.0__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.

Potentially problematic release.


This version of starbash might be problematic. Click here for more details.

@@ -0,0 +1,137 @@
1
+ """Selection commands for filtering sessions and targets."""
2
+
3
+ import typer
4
+ from typing_extensions import Annotated
5
+ from rich.table import Table
6
+
7
+ from starbash.app import Starbash
8
+ from starbash import console
9
+
10
+ app = typer.Typer()
11
+
12
+
13
+ @app.command(name="any")
14
+ def clear():
15
+ """Remove any filters on sessions, etc... (select everything)."""
16
+ with Starbash("selection-clear") as sb:
17
+ sb.selection.clear()
18
+ console.print("[green]Selection cleared - now selecting all sessions[/green]")
19
+
20
+
21
+ @app.command()
22
+ def target(
23
+ target_name: Annotated[
24
+ str,
25
+ typer.Argument(
26
+ help="Target name to add to the selection (e.g., 'M31', 'NGC 7000')"
27
+ ),
28
+ ],
29
+ ):
30
+ """Limit the current selection to only the named target."""
31
+ with Starbash("selection-target") as sb:
32
+ # For now, replace existing targets with this one
33
+ # In the future, we could support adding multiple targets
34
+ sb.selection.targets = []
35
+ sb.selection.add_target(target_name)
36
+ console.print(f"[green]Selection limited to target: {target_name}[/green]")
37
+
38
+
39
+ @app.command()
40
+ def telescope(
41
+ telescope_name: Annotated[
42
+ str,
43
+ typer.Argument(
44
+ help="Telescope name to add to the selection (e.g., 'Vespera', 'EdgeHD 8')"
45
+ ),
46
+ ],
47
+ ):
48
+ """Limit the current selection to only the named telescope."""
49
+ with Starbash("selection-telescope") as sb:
50
+ # For now, replace existing telescopes with this one
51
+ # In the future, we could support adding multiple telescopes
52
+ sb.selection.telescopes = []
53
+ sb.selection.add_telescope(telescope_name)
54
+ console.print(
55
+ f"[green]Selection limited to telescope: {telescope_name}[/green]"
56
+ )
57
+
58
+
59
+ @app.command()
60
+ def date(
61
+ operation: Annotated[
62
+ str,
63
+ typer.Argument(help="Date operation: 'after', 'before', or 'between'"),
64
+ ],
65
+ date_value: Annotated[
66
+ str,
67
+ typer.Argument(
68
+ help="Date in ISO format (YYYY-MM-DD) or two dates separated by space for 'between'"
69
+ ),
70
+ ],
71
+ end_date: Annotated[
72
+ str | None,
73
+ typer.Argument(help="End date for 'between' operation (YYYY-MM-DD)"),
74
+ ] = None,
75
+ ):
76
+ """Limit to sessions in the specified date range.
77
+
78
+ Examples:
79
+ starbash selection date after 2023-10-01
80
+ starbash selection date before 2023-12-31
81
+ starbash selection date between 2023-10-01 2023-12-31
82
+ """
83
+ with Starbash("selection-date") as sb:
84
+ operation = operation.lower()
85
+
86
+ if operation == "after":
87
+ sb.selection.set_date_range(start=date_value, end=None)
88
+ console.print(
89
+ f"[green]Selection limited to sessions after {date_value}[/green]"
90
+ )
91
+ elif operation == "before":
92
+ sb.selection.set_date_range(start=None, end=date_value)
93
+ console.print(
94
+ f"[green]Selection limited to sessions before {date_value}[/green]"
95
+ )
96
+ elif operation == "between":
97
+ if not end_date:
98
+ console.print(
99
+ "[red]Error: 'between' operation requires two dates[/red]"
100
+ )
101
+ raise typer.Exit(1)
102
+ sb.selection.set_date_range(start=date_value, end=end_date)
103
+ console.print(
104
+ f"[green]Selection limited to sessions between {date_value} and {end_date}[/green]"
105
+ )
106
+ else:
107
+ console.print(
108
+ f"[red]Error: Unknown operation '{operation}'. Use 'after', 'before', or 'between'[/red]"
109
+ )
110
+ raise typer.Exit(1)
111
+
112
+
113
+ @app.callback(invoke_without_command=True)
114
+ def show_selection(ctx: typer.Context):
115
+ """List information about the current selection.
116
+
117
+ This is the default command when no subcommand is specified.
118
+ """
119
+ if ctx.invoked_subcommand is None:
120
+ with Starbash("selection-show") as sb:
121
+ summary = sb.selection.summary()
122
+
123
+ if summary["status"] == "all":
124
+ console.print(f"[yellow]{summary['message']}[/yellow]")
125
+ else:
126
+ table = Table(title="Current Selection")
127
+ table.add_column("Criteria", style="cyan")
128
+ table.add_column("Value", style="green")
129
+
130
+ for criterion in summary["criteria"]:
131
+ parts = criterion.split(": ", 1)
132
+ if len(parts) == 2:
133
+ table.add_row(parts[0], parts[1])
134
+ else:
135
+ table.add_row(criterion, "")
136
+
137
+ console.print(table)
@@ -0,0 +1,63 @@
1
+ import typer
2
+ from typing_extensions import Annotated
3
+
4
+ from starbash.app import Starbash
5
+ from starbash import console
6
+
7
+ app = typer.Typer()
8
+
9
+
10
+ @app.command()
11
+ def analytics(
12
+ enable: Annotated[
13
+ bool,
14
+ typer.Argument(
15
+ help="Enable or disable analytics (crash reports and usage data).",
16
+ ),
17
+ ],
18
+ ):
19
+ """
20
+ Enable or disable analytics (crash reports and usage data).
21
+ """
22
+ with Starbash("analytics-enable") as sb:
23
+ sb.analytics.set_data("analytics.enabled", enable)
24
+ sb.user_repo.config["analytics.enabled"] = enable
25
+ sb.user_repo.write_config()
26
+ status = "enabled" if enable else "disabled"
27
+ console.print(f"Analytics (crash reports) {status}.")
28
+
29
+
30
+ @app.command()
31
+ def name(
32
+ user_name: Annotated[
33
+ str,
34
+ typer.Argument(
35
+ help="Your name for attribution in generated images.",
36
+ ),
37
+ ],
38
+ ):
39
+ """
40
+ Set your name for attribution in generated images.
41
+ """
42
+ with Starbash("user-name") as sb:
43
+ sb.user_repo.config["user.name"] = user_name
44
+ sb.user_repo.write_config()
45
+ console.print(f"User name set to: {user_name}")
46
+
47
+
48
+ @app.command()
49
+ def email(
50
+ user_email: Annotated[
51
+ str,
52
+ typer.Argument(
53
+ help="Your email for attribution in generated images.",
54
+ ),
55
+ ],
56
+ ):
57
+ """
58
+ Set your email for attribution in generated images.
59
+ """
60
+ with Starbash("user-email") as sb:
61
+ sb.user_repo.config["user.email"] = user_email
62
+ sb.user_repo.write_config()
63
+ console.print(f"User email set to: {user_email}")