Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register_command plugin hook #569

Closed
simonw opened this issue Jul 22, 2023 · 3 comments
Closed

register_command plugin hook #569

simonw opened this issue Jul 22, 2023 · 3 comments
Labels
enhancement New feature or request plugins

Comments

@simonw
Copy link
Owner

simonw commented Jul 22, 2023

I'm going to start by adding the register_command hook using the exact same pattern as Datasette and LLM.

Originally posted by @simonw in #567 (comment)

@simonw simonw added the plugins label Jul 22, 2023
@simonw
Copy link
Owner Author

simonw commented Jul 22, 2023

Here's where I added that to LLM: simonw/llm@a396950

@simonw simonw added the enhancement New feature or request label Jul 22, 2023
@simonw
Copy link
Owner Author

simonw commented Jul 22, 2023

Example plugin: https://gist.github.com/simonw/ccfbbf9b384a38ac7535b01849f57daf

sqlite-utils install https://gist.github.com/simonw/ccfbbf9b384a38ac7535b01849f57daf/archive/cd7960e476c441a3c5f619e2a44a641a39b91467.zip

pyproject.toml:

[project]
name = "sqlite-utils-hello-world"
version = "0.1"

[project.entry-points.sqlite_utils]
hello_world = "sqlite_utils_hello_world"

sqlite_utils_hello_world.py:

import click
import sqlite_utils


@sqlite_utils.hookimpl
def register_commands(cli):
    @cli.command()
    def hello_world():
        "Say hello world"
        click.echo("Hello world!")

@simonw
Copy link
Owner Author

simonw commented Jul 22, 2023

@simonw simonw closed this as completed Jul 22, 2023
simonw added a commit that referenced this issue Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugins
Projects
None yet
Development

No branches or pull requests

1 participant