kopia lustrzana https://github.com/simonw/datasette
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.pull/1610/head
rodzic
14e320329f
commit
43c30ce023
|
@ -770,7 +770,7 @@ class Datasette:
|
|||
"static": p["static_path"] is not None,
|
||||
"templates": p["templates_path"] is not None,
|
||||
"version": p.get("version"),
|
||||
"hooks": p["hooks"],
|
||||
"hooks": list(set(p["hooks"])),
|
||||
}
|
||||
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::
|
||||
|
||||
$ datasette plugins --all
|
||||
[
|
||||
{
|
||||
"name": "datasette.publish.heroku",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"publish_subcommand"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.sql_functions",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"prepare_connection"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.publish.cloudrun",
|
||||
"name": "datasette.actor_auth_cookie",
|
||||
"static": 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",
|
||||
"static": false,
|
||||
"templates": false,
|
||||
"version": null
|
||||
"version": null,
|
||||
"hooks": [
|
||||
"register_facet_classes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "datasette.publish.heroku",
|
||||
"name": "datasette.default_magic_parameters",
|
||||
"static": 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.
|
||||
|
||||
.. _plugins_configuration:
|
||||
|
|
Ładowanie…
Reference in New Issue