Skip to content

Commit 9152472

Browse files
committed
Use click group to organize storage commands
1 parent efe5d60 commit 9152472

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

nmdc_server/cli.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,14 @@ def generate_static_files(remove_existing):
349349
click.echo("Done generating static files.")
350350

351351

352-
@cli.command()
353-
def ensure_storage_buckets():
352+
@cli.group(name="storage")
353+
def storage_group():
354+
"""Commands for managing storage buckets and objects."""
355+
pass
356+
357+
358+
@storage_group.command()
359+
def init():
354360
"""Ensure that the storage buckets exist."""
355361
for bucket_name in BucketName:
356362
click.echo(f"Ensuring bucket '{bucket_name}' exists")
@@ -367,9 +373,9 @@ def ensure_storage_buckets():
367373
)
368374

369375

370-
@cli.command()
376+
@storage_group.command()
371377
@click.option("--dry-run", is_flag=True, default=False)
372-
def vacuum_storage_buckets(dry_run: bool):
378+
def vacuum(dry_run: bool):
373379
"""Vacuum the storage buckets to remove objects not referenced in the database."""
374380
for bucket_name in BucketName:
375381
click.echo(f"Vacuuming bucket '{bucket_name}'")

start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ nmdc-server migrate
2222
nmdc-server generate-static-files --remove-existing
2323

2424
# Ensure cloud storage is set up
25-
nmdc-server ensure-storage-buckets
25+
nmdc-server storage init
2626

2727
## Start the server
2828
uvicorn nmdc_server.asgi:app --host 0.0.0.0 --port 8000

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ passenv =
1919
NMDC_TESTING_DATABASE_URI
2020
commands =
2121
nmdc-server generate-static-files --remove-existing
22-
nmdc-server ensure-storage-buckets
22+
nmdc-server storage init
2323
pytest {posargs} tests/
2424

2525
[testenv:ingest]

0 commit comments

Comments
 (0)