Skip to content

Commit fdb9e80

Browse files
committed
Command descriptions
1 parent 8d1d76e commit fdb9e80

File tree

31 files changed

+72
-181
lines changed

31 files changed

+72
-181
lines changed

example/app/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def cli():
1717
@cli.command()
1818
@click.argument("email")
1919
def enable_admin_user(email):
20-
"""Enable admin privileges for a user."""
20+
"""Enable admin privileges for a user"""
2121
result = User.query.filter(email=email).update(is_admin=True)
2222
if result:
2323
click.echo(f"User {email} is now an admin.")

plain-api/plain/api/cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
@register_cli("api")
1515
@click.group()
1616
def cli() -> None:
17-
"""API commands."""
18-
pass
17+
"""API commands"""
1918

2019

2120
@cli.command()

plain-cache/plain/cache/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
@register_cli("cache")
99
@click.group()
1010
def cli() -> None:
11-
pass
11+
"""Cache management"""
1212

1313

1414
@cli.command()
1515
def clear_expired() -> None:
16+
"""Clear expired cache entries"""
1617
click.echo("Clearing expired cache items...")
1718
result = CachedItem.query.expired().delete()
1819
click.echo(f"Deleted {result[0]} expired cache items.")
@@ -21,6 +22,7 @@ def clear_expired() -> None:
2122
@cli.command()
2223
@click.option("--force", is_flag=True)
2324
def clear_all(force: bool) -> None:
25+
"""Clear all cache entries"""
2426
if not force and not click.confirm(
2527
"Are you sure you want to delete all cache items?"
2628
):
@@ -32,6 +34,7 @@ def clear_all(force: bool) -> None:
3234

3335
@cli.command()
3436
def stats() -> None:
37+
"""Show cache statistics"""
3538
total = CachedItem.query.count()
3639
expired = CachedItem.query.expired().count()
3740
unexpired = CachedItem.query.unexpired().count()

plain-code/plain/code/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def cli() -> None:
3030
@click.option("--force", is_flag=True, help="Reinstall even if up to date")
3131
@click.pass_context
3232
def install(ctx: click.Context, force: bool) -> None:
33-
"""Install or update the Biome standalone per configuration."""
33+
"""Install or update Biome binary"""
3434
config = get_code_config()
3535

3636
if not config.get("biome", {}).get("enabled", True):
@@ -58,7 +58,7 @@ def install(ctx: click.Context, force: bool) -> None:
5858
@without_runtime_setup
5959
@cli.command()
6060
def update() -> None:
61-
"""Update the Biome standalone binary to the latest release."""
61+
"""Update Biome to latest version"""
6262
config = get_code_config()
6363

6464
if not config.get("biome", {}).get("enabled", True):
@@ -76,7 +76,7 @@ def update() -> None:
7676
@click.pass_context
7777
@click.argument("path", default=".")
7878
def check(ctx: click.Context, path: str) -> None:
79-
"""Check the given path for formatting or linting issues."""
79+
"""Check for formatting and linting issues"""
8080
ruff_args = ["--config", str(DEFAULT_RUFF_CONFIG)]
8181
config = get_code_config()
8282

@@ -127,7 +127,7 @@ def maybe_exit(return_code: int) -> None:
127127
@click.option("--unsafe-fixes", is_flag=True, help="Apply ruff unsafe fixes")
128128
@click.option("--add-noqa", is_flag=True, help="Add noqa comments to suppress errors")
129129
def fix(ctx: click.Context, path: str, unsafe_fixes: bool, add_noqa: bool) -> None:
130-
"""Lint and format the given path."""
130+
"""Fix formatting and linting issues"""
131131
ruff_args = ["--config", str(DEFAULT_RUFF_CONFIG)]
132132
config = get_code_config()
133133

plain-dev/plain/dev/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def cli(
129129
start: bool,
130130
stop: bool,
131131
) -> None:
132-
"""Start local development"""
132+
"""Local development server"""
133133
if ctx.invoked_subcommand:
134134
return
135135

@@ -223,7 +223,7 @@ def _connect() -> subprocess.CompletedProcess[bytes]:
223223
@click.option("--start", is_flag=True, help="Start in the background")
224224
@click.option("--stop", is_flag=True, help="Stop the background process")
225225
def services(start: bool, stop: bool) -> None:
226-
"""Start additional services defined in pyproject.toml"""
226+
"""Start additional development services"""
227227

228228
if start and stop:
229229
raise click.UsageError(
@@ -263,7 +263,7 @@ def services(start: bool, stop: bool) -> None:
263263
@click.option("--path", is_flag=True, help="Output log file path")
264264
@click.option("--services", is_flag=True, help="Show logs for services")
265265
def logs(follow: bool, pid: int | None, path: bool, services: bool) -> None:
266-
"""Show logs from recent plain dev runs."""
266+
"""Show recent development logs"""
267267

268268
if services:
269269
log_dir = PLAIN_TEMP_PATH / "dev" / "logs" / "services"
@@ -299,7 +299,7 @@ def logs(follow: bool, pid: int | None, path: bool, services: bool) -> None:
299299
)
300300
@click.argument("entrypoint", required=False)
301301
def entrypoint(show_list: bool, entrypoint: str | None) -> None:
302-
"""Entrypoints registered under plain.dev"""
302+
"""Run registered development entrypoints"""
303303
if not show_list and not entrypoint:
304304
raise click.UsageError("Please provide an entrypoint name or use --list")
305305

plain-dev/plain/dev/contribute/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
)
2121
@click.argument("packages", nargs=-1)
2222
def cli(packages: tuple[str, ...], repo: str, reset: bool, all_packages: bool) -> None:
23-
"""Contribute to plain by linking packages locally."""
23+
"""Link Plain packages for local development"""
2424

2525
if reset:
2626
click.secho("Undoing any changes to pyproject.toml and uv.lock", bold=True)

plain-jobs/plain/jobs/cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@register_cli("jobs")
2323
@click.group()
2424
def cli() -> None:
25-
pass
25+
"""Background job management"""
2626

2727

2828
@cli.command()
@@ -75,7 +75,7 @@ def worker(
7575
stats_every: int,
7676
reload: bool,
7777
) -> None:
78-
"""Run the job worker."""
78+
"""Run the job worker"""
7979
jobs_schedule = load_schedule(settings.JOBS_SCHEDULE)
8080

8181
if reload:
@@ -140,7 +140,7 @@ def _shutdown(signalnum: int, _: Any) -> None:
140140

141141
@cli.command()
142142
def clear() -> None:
143-
"""Clear all completed job results in all queues."""
143+
"""Clear completed job results"""
144144
cutoff = timezone.now() - datetime.timedelta(
145145
seconds=settings.JOBS_RESULTS_RETENTION
146146
)
@@ -151,7 +151,7 @@ def clear() -> None:
151151

152152
@cli.command()
153153
def stats() -> None:
154-
"""Stats across all queues."""
154+
"""Show job queue statistics"""
155155
pending = JobRequest.query.count()
156156
processing = JobProcess.query.count()
157157

@@ -168,7 +168,7 @@ def stats() -> None:
168168

169169
@cli.command()
170170
def purge() -> None:
171-
"""Delete all running and pending jobs regardless of queue."""
171+
"""Delete all pending and running jobs"""
172172
if not click.confirm(
173173
"Are you sure you want to clear all running and pending jobs? This will delete all current Jobs and JobRequests"
174174
):
@@ -184,7 +184,7 @@ def purge() -> None:
184184
@cli.command()
185185
@click.argument("job_class_name", type=str)
186186
def run(job_class_name: str) -> None:
187-
"""Run a job class directly (and not using a worker)."""
187+
"""Run a job directly without a worker"""
188188
job = jobs_registry.load_job(job_class_name, {"args": [], "kwargs": {}})
189189
click.secho("Loaded job: ", bold=True, nl=False)
190190
print(job)
@@ -193,7 +193,7 @@ def run(job_class_name: str) -> None:
193193

194194
@cli.command("list")
195195
def list_jobs() -> None:
196-
"""List all registered jobs."""
196+
"""List all registered jobs"""
197197
for name, job_class in jobs_registry.jobs.items():
198198
click.secho(f"{name}", bold=True, nl=False)
199199
# Get description from class docstring

plain-models/plain/models/backups/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
import click
88

99
from plain.cli import register_cli
10-
from plain.cli.runtime import common_command
1110

1211
from .core import DatabaseBackups
1312

1413

15-
@common_command
1614
@register_cli("backups", shortcut_for="models")
1715
@click.group("backups")
1816
def cli() -> None:
@@ -22,6 +20,7 @@ def cli() -> None:
2220

2321
@cli.command("list")
2422
def list_backups() -> None:
23+
"""List database backups"""
2524
backups_handler = DatabaseBackups()
2625
backups = backups_handler.find_backups()
2726
if not backups:
@@ -45,6 +44,7 @@ def list_backups() -> None:
4544
@click.option("--pg-dump", default="pg_dump", envvar="PG_DUMP")
4645
@click.argument("backup_name", default="")
4746
def create_backup(backup_name: str, pg_dump: str) -> None:
47+
"""Create a database backup"""
4848
backups_handler = DatabaseBackups()
4949

5050
if not backup_name:
@@ -67,6 +67,7 @@ def create_backup(backup_name: str, pg_dump: str) -> None:
6767
@click.option("--pg-restore", default="pg_restore", envvar="PG_RESTORE")
6868
@click.argument("backup_name", default="")
6969
def restore_backup(backup_name: str, latest: bool, pg_restore: str) -> None:
70+
"""Restore a database backup"""
7071
backups_handler = DatabaseBackups()
7172

7273
if backup_name and latest:
@@ -94,6 +95,7 @@ def restore_backup(backup_name: str, latest: bool, pg_restore: str) -> None:
9495
@cli.command("delete")
9596
@click.argument("backup_name")
9697
def delete_backup(backup_name: str) -> None:
98+
"""Delete a database backup"""
9799
backups_handler = DatabaseBackups()
98100
try:
99101
backups_handler.delete(backup_name)
@@ -106,6 +108,7 @@ def delete_backup(backup_name: str) -> None:
106108
@cli.command("clear")
107109
@click.confirmation_option(prompt="Are you sure you want to delete all backups?")
108110
def clear_backups() -> None:
111+
"""Clear all database backups"""
109112
backups_handler = DatabaseBackups()
110113
backups = backups_handler.find_backups()
111114
for backup in backups:

plain-models/plain/models/cli.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
@register_cli("models")
4646
@click.group()
4747
def cli() -> None:
48-
pass
48+
"""Database model management"""
4949

5050

5151
cli.add_command(backups_cli)
@@ -54,7 +54,7 @@ def cli() -> None:
5454
@cli.command()
5555
@click.argument("parameters", nargs=-1)
5656
def db_shell(parameters: tuple[str, ...]) -> None:
57-
"""Runs the command-line client for specified database, or the default database if none is provided."""
57+
"""Open an interactive database shell"""
5858
try:
5959
db_connection.client.runshell(list(parameters))
6060
except FileNotFoundError:
@@ -114,7 +114,7 @@ def db_wait() -> None:
114114
help="Only show models from packages that start with 'app'.",
115115
)
116116
def list_models(package_labels: tuple[str, ...], app_only: bool) -> None:
117-
"""List installed models."""
117+
"""List all installed models"""
118118

119119
packages = set(package_labels)
120120

@@ -176,7 +176,7 @@ def makemigrations(
176176
check: bool,
177177
verbosity: int,
178178
) -> None:
179-
"""Creates new migration(s) for packages."""
179+
"""Create new database migrations"""
180180

181181
written_files: list[str] = []
182182
interactive = not no_input
@@ -397,7 +397,7 @@ def migrate(
397397
atomic_batch: bool | None,
398398
quiet: bool,
399399
) -> None:
400-
"""Updates database schema. Manages both packages with migrations and those without."""
400+
"""Apply database migrations"""
401401

402402
def migration_progress_callback(
403403
action: str,
@@ -713,7 +713,7 @@ def describe_operation(operation: Any) -> tuple[str, bool]:
713713
def show_migrations(
714714
package_labels: tuple[str, ...], format: str, verbosity: int
715715
) -> None:
716-
"""Shows all available migrations for the current project"""
716+
"""Show all available migrations"""
717717

718718
def _validate_package_names(package_names: tuple[str, ...]) -> None:
719719
has_bad_names = False
@@ -834,7 +834,7 @@ def print_deps(node: Any) -> str:
834834
help="Skip confirmation prompt (for non-interactive use).",
835835
)
836836
def prune_migrations(yes: bool) -> None:
837-
"""Show and optionally remove stale migration records from the database."""
837+
"""Prune stale migration records"""
838838
# Load migrations from disk and database
839839
loader = MigrationLoader(db_connection, ignore_no_migrations=True)
840840
recorder = MigrationRecorder(db_connection)
@@ -962,9 +962,7 @@ def squash_migrations(
962962
squashed_name: str | None,
963963
verbosity: int,
964964
) -> None:
965-
"""
966-
Squashes an existing set of migrations (from first until specified) into a single new one.
967-
"""
965+
"""Squash multiple migrations into one"""
968966
interactive = not no_input
969967

970968
def find_migration(

0 commit comments

Comments
 (0)