Replies: 1 comment 4 replies
-
Both actually, but I can see why it's not very intuitive how to do that for local scripts. We should extend the documentation there. The CLI discovers additional commands via entry points, as described in the docs. These still work for local projects, if you install them. The reasoning behind doing it like that was that other ways require quite a bit of workarounds and magic to end up with a solution that behaves like you'd expect it to in all situations (for example, if you have a programmatic hook, this won't be available before your code runs, meaning you can't run code from the same module via the CLI). The easiest solution for this was to simply use entry points for 3rd party and local packages alike. The only other somewhat viable option I could think of would be to have some autodiscovery magic, that picks up commands from a predefined path, e.g. Currently, the solution is to do something like [tool.poetry.plugins."starlite.commands"]
my_command = "my_app.cli:main" assuming you Would this be sufficient for your use case for the time being? You are of course welcome to make suggestions for how to better handle this. |
Beta Was this translation helpful? Give feedback.
-
Hi!
I'm currently playing around with Starlite and was very pleased that it has a CLI and even a concept of extending it, but I think might've misunderstood the purpose / target audience.
Is it meant for third party (pip installable) plugins, or is it meant for adding project specific scripts (the equivalent of custom Django commands)?
I was looking for the latter (custom project specific scripts), but - and please correct me if I'm wrong - it's currently meant for third party (pip installable) plugins?
I tried hacking my way to add a custom
click
based subcommand to it but with no luck. If you'd be open to the idea let me know so I can create a proper feature request and even potentially work on implementing it.Beta Was this translation helpful? Give feedback.
All reactions