Open simonw opened 8 months ago
I'm deleting the prototype code for this for the moment:
@click.command()
@click.argument(
"database",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
required=True,
)
@click.argument("table", required=True)
def extract(database, table):
click.echo("Will extract to {} in {}".format(table, database))
@hookimpl
def register_commands(cli):
cli.add_command(extract, name="extract")
And test_cli.py
:
from datasette.cli import cli
from click.testing import CliRunner
def test_extract_command():
runner = CliRunner()
result = runner.invoke(cli, ["extract", "database", "table"])
assert result.exit_code == 0
assert result.output == "Will extract to table in database\n"
When this enhancement exists, it will fix the issue I'm seeing. I'm parsing through the General Exam Ham Radio Question Pool.
ChatGPT keeps stopping for a variety of reasons. Then,
With the CLI, I could turn 1 - 3 into a loop and crank along :)
So you can run extract on the CLI in addition to through the web UI.