mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Use cog to maintain default plugin list in plugins.rst, closes #1600
Also fixed a bug I spotted where datasette.filters showed the same hook three times.
This commit is contained in:
parent
14e320329f
commit
43c30ce023
2 changed files with 91 additions and 8 deletions
|
|
@ -770,7 +770,7 @@ class Datasette:
|
||||||
"static": p["static_path"] is not None,
|
"static": p["static_path"] is not None,
|
||||||
"templates": p["templates_path"] is not None,
|
"templates": p["templates_path"] is not None,
|
||||||
"version": p.get("version"),
|
"version": p.get("version"),
|
||||||
"hooks": p["hooks"],
|
"hooks": list(set(p["hooks"])),
|
||||||
}
|
}
|
||||||
for p in ps
|
for p in ps
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -91,36 +91,119 @@ You can also use the ``datasette plugins`` command::
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
.. [[[cog
|
||||||
|
from datasette import cli
|
||||||
|
from click.testing import CliRunner
|
||||||
|
import textwrap, json
|
||||||
|
cog.out("\n")
|
||||||
|
result = CliRunner().invoke(cli.cli, ["plugins", "--all"])
|
||||||
|
# cog.out() with text containing newlines was unindenting for some reason
|
||||||
|
cog.outl("If you run ``datasette plugins --all`` it will include default plugins that ship as part of Datasette::\n")
|
||||||
|
plugins = [p for p in json.loads(result.output) if p["name"].startswith("datasette.")]
|
||||||
|
indented = textwrap.indent(json.dumps(plugins, indent=4), " ")
|
||||||
|
for line in indented.split("\n"):
|
||||||
|
cog.outl(line)
|
||||||
|
cog.out("\n\n")
|
||||||
|
.. ]]]
|
||||||
|
|
||||||
If you run ``datasette plugins --all`` it will include default plugins that ship as part of Datasette::
|
If you run ``datasette plugins --all`` it will include default plugins that ship as part of Datasette::
|
||||||
|
|
||||||
$ datasette plugins --all
|
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"name": "datasette.publish.heroku",
|
||||||
|
"static": false,
|
||||||
|
"templates": false,
|
||||||
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"publish_subcommand"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "datasette.sql_functions",
|
"name": "datasette.sql_functions",
|
||||||
"static": false,
|
"static": false,
|
||||||
"templates": false,
|
"templates": false,
|
||||||
"version": null
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"prepare_connection"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "datasette.publish.cloudrun",
|
"name": "datasette.actor_auth_cookie",
|
||||||
"static": false,
|
"static": false,
|
||||||
"templates": false,
|
"templates": false,
|
||||||
"version": null
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"actor_from_request"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "datasette.blob_renderer",
|
||||||
|
"static": false,
|
||||||
|
"templates": false,
|
||||||
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"register_output_renderer"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "datasette.facets",
|
"name": "datasette.facets",
|
||||||
"static": false,
|
"static": false,
|
||||||
"templates": false,
|
"templates": false,
|
||||||
"version": null
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"register_facet_classes"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "datasette.publish.heroku",
|
"name": "datasette.default_magic_parameters",
|
||||||
"static": false,
|
"static": false,
|
||||||
"templates": false,
|
"templates": false,
|
||||||
"version": null
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"register_magic_parameters"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "datasette.default_permissions",
|
||||||
|
"static": false,
|
||||||
|
"templates": false,
|
||||||
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"permission_allowed"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "datasette.default_menu_links",
|
||||||
|
"static": false,
|
||||||
|
"templates": false,
|
||||||
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"menu_links"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "datasette.filters",
|
||||||
|
"static": false,
|
||||||
|
"templates": false,
|
||||||
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"filters_from_request"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "datasette.publish.cloudrun",
|
||||||
|
"static": false,
|
||||||
|
"templates": false,
|
||||||
|
"version": null,
|
||||||
|
"hooks": [
|
||||||
|
"publish_subcommand"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
.. [[[end]]]
|
||||||
|
|
||||||
You can add the ``--plugins-dir=`` option to include any plugins found in that directory.
|
You can add the ``--plugins-dir=`` option to include any plugins found in that directory.
|
||||||
|
|
||||||
.. _plugins_configuration:
|
.. _plugins_configuration:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue