Skip to content

Commit 0af36e1

Browse files
committed
Standardize CLI confirmation skip flag to --yes/-y across all packages
1 parent 86f7f5b commit 0af36e1

8 files changed

Lines changed: 21 additions & 15 deletions

File tree

plain-cache/plain/cache/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def clear_expired() -> None:
2020

2121

2222
@cli.command()
23-
@click.option("--force", is_flag=True)
24-
def clear_all(force: bool) -> None:
23+
@click.option("--yes", "-y", is_flag=True, help="Skip confirmation prompt.")
24+
def clear_all(yes: bool) -> None:
2525
"""Clear all cache entries"""
26-
if not force and not click.confirm(
26+
if not yes and not click.confirm(
2727
"Are you sure you want to delete all cache items?"
2828
):
2929
return

plain-jobs/plain/jobs/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,10 @@ def stats() -> None:
165165

166166

167167
@cli.command()
168-
def purge() -> None:
168+
@click.option("--yes", "-y", is_flag=True, help="Skip confirmation prompt.")
169+
def purge(yes: bool) -> None:
169170
"""Delete all pending and running jobs"""
170-
if not click.confirm(
171+
if not yes and not click.confirm(
171172
"Are you sure you want to clear all running and pending jobs? This will delete all current Jobs and JobRequests"
172173
):
173174
return

plain-observer/plain/observer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ plain observer span <span_id>
118118

119119
# Clear all trace data
120120
plain observer clear
121-
plain observer clear --force
121+
plain observer clear --yes
122122
```
123123

124124
The `observer request` command makes a request with tracing automatically enabled and returns structured JSON output including query counts, duplicate detection, issue analysis, and a span tree. The `--user` flag accepts a user ID or email.

plain-observer/plain/observer/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ def span_to_dict(span: Span) -> dict[str, Any]:
261261

262262

263263
@observer_cli.command()
264-
@click.option("--force", is_flag=True, help="Skip confirmation prompt.")
265-
def clear(force: bool) -> None:
264+
@click.option("--yes", "-y", is_flag=True, help="Skip confirmation prompt.")
265+
def clear(yes: bool) -> None:
266266
"""Clear all observer data"""
267267
query = Trace.query.all()
268268
trace_count = query.count()
@@ -271,7 +271,7 @@ def clear(force: bool) -> None:
271271
click.echo("No traces to clear.")
272272
return
273273

274-
if not force:
274+
if not yes:
275275
confirm_msg = f"Are you sure you want to clear {trace_count} trace(s)? This will delete all observer data."
276276
click.confirm(confirm_msg, abort=True)
277277

plain-portal/plain/portal/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ def cli() -> None:
5252
default=DEFAULT_RELAY_HOST,
5353
hidden=True,
5454
)
55-
def start(writable: bool, timeout: int, relay_host: str) -> None:
55+
@click.option("--yes", "-y", is_flag=True, help="Skip confirmation prompt.")
56+
def start(writable: bool, timeout: int, relay_host: str, yes: bool) -> None:
5657
"""Start a portal session on the remote machine."""
57-
if writable:
58+
if writable and not yes:
5859
if not click.confirm(
5960
"This session allows writes to the production database. Continue?"
6061
):

plain-postgres/plain/postgres/backups/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ def delete_backup(backup_name: str) -> None:
138138

139139

140140
@cli.command("clear")
141-
@click.confirmation_option(prompt="Are you sure you want to delete all backups?")
142-
def clear_backups() -> None:
141+
@click.option("--yes", "-y", is_flag=True, help="Skip confirmation prompt.")
142+
def clear_backups(yes: bool) -> None:
143143
"""Clear all database backups"""
144144
backups_handler = DatabaseBackups()
145145
backups = backups_handler.find_backups()
146+
if not yes:
147+
click.confirm("Are you sure you want to delete all backups?", abort=True)
146148
for backup in backups:
147149
backup.delete()
148150
click.secho("All backups deleted", fg="green")

plain-postgres/plain/postgres/cli/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ def shell(parameters: tuple[str, ...]) -> None:
6161
@cli.command("drop-unknown-tables")
6262
@click.option(
6363
"--yes",
64+
"-y",
6465
is_flag=True,
65-
help="Skip confirmation prompt (for non-interactive use).",
66+
help="Skip confirmation prompt.",
6667
)
6768
def drop_unknown_tables(yes: bool) -> None:
6869
"""Drop all tables not associated with a Plain model"""

plain-postgres/plain/postgres/cli/migrations.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,9 @@ def print_deps(node: Any) -> str:
777777
@cli.command("prune")
778778
@click.option(
779779
"--yes",
780+
"-y",
780781
is_flag=True,
781-
help="Skip confirmation prompt (for non-interactive use).",
782+
help="Skip confirmation prompt.",
782783
)
783784
def prune(yes: bool) -> None:
784785
"""Remove stale migration records from the database"""

0 commit comments

Comments
 (0)