getkirby / cli

Kirby Command Line Interface
MIT License
51 stars 5 forks source link

New `plugin` commands #63

Closed afbora closed 7 months ago

afbora commented 7 months ago
kirby plugin:install getkirby/kql
kirby plugin:remove getkirby/kql
kirby plugin:upgrade getkirby/kql
bastianallgeier commented 7 months ago

I wonder if we should use the existing main groups instead of plugin:

kirby install:plugin getkirby/kql
kirby upgrade:plugin getkirby/kql
kirby remove:plugin getkirby/kql

Especially since there already is make:plugin.

We broke this for the uuid commands. But maybe we could change that in the future. I think we really just need to commit to one standard. @distantnative @lukasbestle what are your thoughts on this?

lukasbestle commented 7 months ago

I agree it would be good to be consistent.

I don't have a strong preference about the order. Namespacing by type (like plugin:install) fits well semantically, but namespacing by command (like install:plugin) works better with commands like make (we have many of them and most types will only ever have a make command.

afbora commented 7 months ago

install:*, remove:*, upgrade:* syntax make sense but I still favor of plugin:* syntax. I'm thinking to create plugin command about versions. We can use plugin:* syntax for all plugin related commands. For example: kirby plugin:check and kirby plugin:check --all. This commands checks plugin(s) versions.

bastianallgeier commented 7 months ago

I agree that the plugin namespace is a bit of an extra case here. I think there will be a lot of additional useful commands for plugins.

Maybe in this case we could think about adding aliases for install, remove and upgrade? On the other hand, aliases could also create even more confusion. Let's maybe keep the plugin namespace as default for now. We can still add aliases later if needed.

afbora commented 7 months ago

Great! Do you want to me change command names? uptate to upgrade and delete to remove.

afbora commented 7 months ago

@bastianallgeier Ready to review and need your last touches 🙂

bastianallgeier commented 7 months ago

I made a first few small changes and had a few thoughts:

plugin:install

I think we need to check for the plugin type in the composer json. So far I can basically install any Github repo and it does not really need to be a proper Kirby plugin. I think it would be good to use this as a sanity check.

plugin:remove

If a plugin does not have an index.php and does not call Kirby::plugin(), it cannot be removed.

afbora commented 7 months ago

@bastianallgeier If anonymous plugin installed (for ex: /site/plugins/hello-world), you need to call kirby plugin:remove plugins/hello-world. Anonymous plugins registry name is plugins/DIRNAME.