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.
This commit is contained in:
Simon Willison 2019-01-24 23:04:52 -08:00
commit 9501ba4bf1
4 changed files with 13 additions and 13 deletions

View file

@ -9,9 +9,9 @@
This release implements the ``sqlite-utils`` command-line tool with a number of useful subcommands. 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 tables demo.db`` lists the tables in the database
- ``sqlite-utils table_names demo.db --fts4`` shows just the FTS4 tables - ``sqlite-utils tables 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 --fts5`` shows just the FTS5 tables
- ``sqlite-utils vacuum demo.db`` runs VACUUM against the database - ``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`` runs OPTIMIZE against all FTS tables, then VACUUM
- ``sqlite-utils optimize demo.db --no-vacuum`` runs OPTIMIZE but skips VACUUM - ``sqlite-utils optimize demo.db --no-vacuum`` runs OPTIMIZE but skips VACUUM

View file

@ -9,16 +9,16 @@ The ``sqlite-utils`` command-line tool can be used to manipulate SQLite database
Listing tables 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 dogs
cats cats
chickens chickens
If you just want to see the FTS4 tables, you can use ``--fts4`` (or ``--fts5`` for FTS5 tables):: 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 docs_fts
.. _cli_inserting_data: .. _cli_inserting_data:

View file

@ -22,7 +22,7 @@ def cli():
@click.option( @click.option(
"--fts5", help="Just show FTS5 enabled tables", default=False, is_flag=True "--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""" """List the tables in the database"""
db = sqlite_utils.Database(path) db = sqlite_utils.Database(path)
for name in db.table_names(fts4=fts4, fts5=fts5): for name in db.table_names(fts4=fts4, fts5=fts5):

View file

@ -20,20 +20,20 @@ def db_path(tmpdir):
return path return path
def test_table_names(db_path): def test_tables(db_path):
result = CliRunner().invoke(cli.cli, ["table_names", db_path]) result = CliRunner().invoke(cli.cli, ["tables", db_path])
assert "Gosh\nGosh2" == result.output.strip() 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") 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() 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") 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() assert "Gosh_fts" == result.output.strip()