python3 -m venv venv
pip install -r requirements.txt-
Create your command file
commands/(commands/mycommand.py) -
Create your command function(s). Here's an example:
import psycopg
from typing import Any
def mycommand(conn: psycopg.Connection, args: list[str], ctx: dict[str, Any]):
print(f"args: {args}")
print(f"ctx: {ctx}")
print(f"conn: {conn}")- Then export the function(s) in
commands/__init__.py
from .mycommand import mycommand- Finally, add the function to the commands dictionary at the top of
cli.py
CMDS: dict[str, Callable[[psycopg.Connection, list[str]], None]] = {
# ...
"mycommand": mycommand
# ...
}Make sure you have the .env file setup accordingly:
SSH_USER=********
SSH_PASSWORD=********
SSH_HOST=********
DB_USER=********
DB_PASSWORD=********
DB_HOST=********
DB_NAME=********
DB_PORT=********