-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdb.yaml
More file actions
48 lines (43 loc) · 1.24 KB
/
Copy pathdb.yaml
File metadata and controls
48 lines (43 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# yaml-language-server: $schema=cliffy_schema.json
manifestVersion: v3 # optional (Default will be the latest)
name: db
version: 0.1.0
help: Database CLI
cli_options:
add_completion: False
requires:
- rich
imports: |
from rich.console import Console
console = Console()
commands:
create|mk:
params: &db_args
- name: DatabaseName
run: |
"""Create a new database"""
console.print(f"Creating database {name}", style="green")
pre_run: |
console.print("Running pre-run hook", style="green")
delete|rm:
params: *db_args
run: |
"""Delete a database"""
sure = typer.confirm("Are you really really really sure?")
if sure:
console.print(f"Deleting database {name}", style="red")
else:
console.print(f"Back to safety!", style="green")
list|ls: |
"""List databases"""
print("Listing all databases")
view|v:
params:
- <<: *db_args
- table: TableName
run: |
"""View database table"""
console.print(f"Viewing {table} table for {name} DB")
types:
DatabaseName: str = typer.Option(..., prompt="What is the name of the database?", confirmation_prompt=True)
TableName: str = typer.Option(..., prompt="What is the name of the table?")