Skip to content

Commit 6ba91e9

Browse files
Copilotkhnumdev
andcommitted
refactor: Change command structure to db push/pull subcommands
Co-authored-by: khnumdev <[email protected]>
1 parent 690de09 commit 6ba91e9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

cli.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def cmd_cleanup(
169169
typer.echo(f"Total entities {'to delete' if dry_run else 'deleted'}: {deleted_sum}")
170170

171171

172-
@app.command("push")
173-
def cmd_push(
172+
db_app = typer.Typer(help="Database backup management commands", no_args_is_help=True)
173+
174+
175+
@db_app.command("push")
176+
def db_push(
174177
version: Annotated[
175178
Optional[str], typer.Argument(help="Version name (defaults to today's date YYYY-mm-DD)")
176179
] = None,
@@ -190,8 +193,8 @@ def cmd_push(
190193
push_to_drive(cfg, version, overwrite, local_db)
191194

192195

193-
@app.command("pull")
194-
def cmd_pull(
196+
@db_app.command("pull")
197+
def db_pull(
195198
version: Annotated[
196199
Optional[str], typer.Argument(help="Version name (omit to download latest)")
197200
] = None,
@@ -208,6 +211,9 @@ def cmd_pull(
208211
pull_from_drive(cfg, version, local_db)
209212

210213

214+
app.add_typer(db_app, name="db")
215+
216+
211217
if __name__ == "__main__":
212218
import sys
213219

0 commit comments

Comments
 (0)