drupal-console-extend-plugin icon indicating copy to clipboard operation
drupal-console-extend-plugin copied to clipboard

Find a more relevant name for 'uninstall'

Open marcelovani opened this issue 8 years ago • 11 comments

I am not sure if I understand the use of the uninstall tag As far as I understand, I need to tag my extended commands with bootstrap: uninstall in order to my commands be discovered. I was wondering if we could come up with a more intuitive name for it, some ideas here:

  • type: standalone
  • type: global
  • type: extend
  • type: custom
  • require-site: no
  • require-drupal: no

I kind of like the first two, but open for more ideas

Also, need to rename this file accordingly https://github.com/hechoendrupal/drupal-console-extend-plugin/blob/master/src/Extender.php#L88

marcelovani avatar Aug 23 '17 21:08 marcelovani

A couple of extra ideas:

  • type: independent
  • type: autonomous

tashaharrison avatar Aug 30 '17 15:08 tashaharrison

type:orphan 🤣

marcelovani avatar Aug 30 '17 15:08 marcelovani

require-bootstrap: false

jmolivas avatar Sep 05 '17 07:09 jmolivas

type:launcher?

davidgrayston avatar Sep 05 '17 09:09 davidgrayston

Instead of using a boolean flag type require-bootstrap: false how about keep bootstrap and have as valid options.

  • none: Do not require a Drupal site.
  • site: Does require a Drupal site, but the Drupal could be not installed.
  • install: Does require a Drupal site and site must be installed.

jmolivas avatar Nov 13 '17 08:11 jmolivas

I like the idea of having multiple values, just throwing another names: We call it scope, which is the scope of the command and can be:

  • global: Does not require a Drupal site (Used to build Drupal sites)
  • site: Requires a Drupal site but does not require Drupal to be installed (Used for ?**)
  • site-install: Requires a site with a Drupal installation (Used for site level commands)

** What would be and example of usage?

Also, would we rename this file or maybe delete it and keep only extend.console.services.yml? See https://github.com/hechoendrupal/drupal-console-extend-plugin/blob/master/src/Extender.php#L88

marcelovani avatar Nov 13 '17 17:11 marcelovani

The idea is to replicate what we have on the annotation

https://github.com/hechoendrupal/drupal-console/blob/master/src/Annotations/DrupalCommand.php

<?php
/**
 * @file
 * Contains \Drupal\Console\Annotations\DrupalCommand.
 */

namespace Drupal\Console\Annotations;

use Doctrine\Common\Annotations\Annotation;
/**
 * @Annotation
 * @Target("CLASS")
 */
class DrupalCommand
{
    /**
     * @var string
     */
    public $extension;

    /**
     * @Enum({"module", "theme", "profile", "library"})
     */
    public $extensionType;

    /**
     * @var array
     */
    public $dependencies;

    /**
     * @Enum({"none", "site", "install"})
     */
    public $bootstrap;
}

We use the annotation like this https://github.com/hechoendrupal/drupal-console/blob/master/src/Command/Features/ImportCommand.php :

<?php

 ... 

use Drupal\Console\Annotations\DrupalCommand;
use Drupal\Console\Core\Command\Command;
/**
 * @DrupalCommand(
 *     extension = "features",
 *     extensionType = "module"
 * )
 */
class ImportCommand extends Command
{

jmolivas avatar Nov 13 '17 18:11 jmolivas

If no bootstrap set on the command annotation the is defaulted to install you can check the DrupalCommandAnnotationReader class here => https://github.com/hechoendrupal/drupal-console/blob/master/src/Annotations/DrupalCommandAnnotationReader.php

jmolivas avatar Nov 13 '17 18:11 jmolivas

I think the site-install name instead of install. Makes sense as well.

Not sure about global since the name of the option is bootstrap and is related to the bootstrap level of the site. I think none make more sense than global.

jmolivas avatar Nov 13 '17 18:11 jmolivas

We can probably use global but we need to rename annotation property from bootstrap to scope which I think will work as well.

Then we can use the names as @marcelovani suggested https://github.com/hechoendrupal/drupal-console-extend-plugin/issues/18#issuecomment-344000715

jmolivas avatar Nov 13 '17 21:11 jmolivas

Thanks for explaining. I reckon, if these annotations are not documented, not many people are using it, so it would be a good time, if we want to rename. And of course, we need to be consistent with annotations, file names, etc. Quick question about https://github.com/hechoendrupal/drupal-console/blob/master/src/Annotations/DrupalCommandAnnotationReader.php#L24, should not that be 'install' in this case?

marcelovani avatar Nov 14 '17 10:11 marcelovani