{"html_url": "https://github.com/simonw/datasette/issues/1538#issuecomment-981856895", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1538", "id": 981856895, "node_id": "IC_kwDOBm6k_c46hfJ_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-29T17:32:44Z", "updated_at": "2021-11-29T17:32:44Z", "author_association": "OWNER", "body": "TIL: https://til.simonwillison.net/datasette/reuse-click-for-register-commands", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1066288689, "label": "Research pattern for re-registering existing Click tools with register_commands"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1538#issuecomment-981852280", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1538", "id": 981852280, "node_id": "IC_kwDOBm6k_c46heB4", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-29T17:27:12Z", "updated_at": "2021-11-29T17:27:12Z", "author_association": "OWNER", "body": "Thanks to https://stackoverflow.com/a/45514541/6083 I found the right pattern:\r\n```python\r\nfrom datasette import hookimpl\r\nfrom git_history.cli import cli as git_history_cli\r\n\r\n@hookimpl\r\ndef register_commands(cli):\r\n cli.add_command(git_history_cli, name=\"git-history\")\r\n```\r\nI think this is a little bit too obscure to add to the Datasette documentation - I'll turn it into a TIL instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1066288689, "label": "Research pattern for re-registering existing Click tools with register_commands"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1538#issuecomment-981849494", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1538", "id": 981849494, "node_id": "IC_kwDOBm6k_c46hdWW", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-11-29T17:23:52Z", "updated_at": "2021-11-29T17:23:52Z", "author_association": "OWNER", "body": "Just trying to use `git_history_file` produces this error:\r\n\r\n> `TypeError: Attempted to convert a callback into a command twice.`\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1066288689, "label": "Research pattern for re-registering existing Click tools with register_commands"}, "performed_via_github_app": null}