From 9501ba4bf1b96aeefe26e261de085839e9a97e67 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 24 Jan 2019 23:04:52 -0800 Subject: [PATCH] sqlite-utils table_names blah.db is now tables blah.db Travis tests were failing because on OS X the command was this: sqlite-utils table_names blah.db But in Travis CI the command was this: sqlite-utils table-names blah.db Renaming it to tables fixes this inconsistency. --- docs/changelog.rst | 6 +++--- docs/cli.rst | 6 +++--- sqlite_utils/cli.py | 2 +- tests/test_cli.py | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 74be94fb5..2064dff53 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,9 +9,9 @@ This release implements the ``sqlite-utils`` command-line tool with a number of useful subcommands. -- ``sqlite-utils table_names demo.db`` lists the tables in the database -- ``sqlite-utils table_names demo.db --fts4`` shows just the FTS4 tables -- ``sqlite-utils table_names demo.db --fts5`` shows just the FTS5 tables +- ``sqlite-utils tables demo.db`` lists the tables in the database +- ``sqlite-utils tables demo.db --fts4`` shows just the FTS4 tables +- ``sqlite-utils tables demo.db --fts5`` shows just the FTS5 tables - ``sqlite-utils vacuum demo.db`` runs VACUUM against the database - ``sqlite-utils optimize demo.db`` runs OPTIMIZE against all FTS tables, then VACUUM - ``sqlite-utils optimize demo.db --no-vacuum`` runs OPTIMIZE but skips VACUUM diff --git a/docs/cli.rst b/docs/cli.rst index 932d64b4a..7b4ace9b3 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -9,16 +9,16 @@ The ``sqlite-utils`` command-line tool can be used to manipulate SQLite database Listing tables ============== -You can list the names of tables in a database using the ``table_names`` subcommand:: +You can list the names of tables in a database using the ``tables`` subcommand:: - $ sqlite-utils table_names mydb.db + $ sqlite-utils tables mydb.db dogs cats chickens If you just want to see the FTS4 tables, you can use ``--fts4`` (or ``--fts5`` for FTS5 tables):: - $ sqlite-utils table_names --fts4 docs.db + $ sqlite-utils tables --fts4 docs.db docs_fts .. _cli_inserting_data: diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 562998175..74f8a21ac 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -22,7 +22,7 @@ def cli(): @click.option( "--fts5", help="Just show FTS5 enabled tables", default=False, is_flag=True ) -def table_names(path, fts4, fts5): +def tables(path, fts4, fts5): """List the tables in the database""" db = sqlite_utils.Database(path) for name in db.table_names(fts4=fts4, fts5=fts5): diff --git a/tests/test_cli.py b/tests/test_cli.py index 6318eb7d2..c89bfc176 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -20,20 +20,20 @@ def db_path(tmpdir): return path -def test_table_names(db_path): - result = CliRunner().invoke(cli.cli, ["table_names", db_path]) +def test_tables(db_path): + result = CliRunner().invoke(cli.cli, ["tables", db_path]) assert "Gosh\nGosh2" == result.output.strip() -def test_table_names_fts4(db_path): +def test_tables_fts4(db_path): Database(db_path)["Gosh"].enable_fts(["c2"], fts_version="FTS4") - result = CliRunner().invoke(cli.cli, ["table_names", "--fts4", db_path]) + result = CliRunner().invoke(cli.cli, ["tables", "--fts4", db_path]) assert "Gosh_fts" == result.output.strip() -def test_table_names_fts5(db_path): +def test_tables_fts5(db_path): Database(db_path)["Gosh"].enable_fts(["c2"], fts_version="FTS5") - result = CliRunner().invoke(cli.cli, ["table_names", "--fts5", db_path]) + result = CliRunner().invoke(cli.cli, ["tables", "--fts5", db_path]) assert "Gosh_fts" == result.output.strip()