diff --git a/src/CRM/CivixBundle/Command/InitCommand.php b/src/CRM/CivixBundle/Command/InitCommand.php
index 9aa9317a..923b6d39 100644
--- a/src/CRM/CivixBundle/Command/InitCommand.php
+++ b/src/CRM/CivixBundle/Command/InitCommand.php
@@ -22,25 +22,29 @@ protected function configure() {
Services::templating();
$this
->setName('generate:module')
- ->setDescription('Create a new CiviCRM Module-Extension (Regenerate module.civix.php if ext.name not specified)')
- ->addArgument('key', InputArgument::OPTIONAL, "Extension identifier (Ex: \"foo-bar\" or \"org.example.foo-bar\")")
+ ->setDescription('Create a new CiviCRM Module-Extension (Regenerate module.civix.php if \"key\" not specified)')
+ ->addArgument('key', InputArgument::OPTIONAL, "Extension identifier (Ex: \"foo_bar\" or \"org.example.foo-bar\")")
->addOption('enable', NULL, InputOption::VALUE_REQUIRED, 'Whether to auto-enable the new module (yes/no/ask)', 'ask')
->addOption('license', NULL, InputOption::VALUE_OPTIONAL, 'License for the extension (' . implode(', ', $this->getLicenses()) . ')', $this->getDefaultLicense())
->addOption('author', NULL, InputOption::VALUE_REQUIRED, 'Name of the author', $this->getDefaultAuthor())
->addOption('email', NULL, InputOption::VALUE_OPTIONAL, 'Email of the author', $this->getDefaultEmail())
->setHelp(
- "Create a new CiviCRM Module-Extension (Regenerate module.civix.php if ext.name not specified)\n" .
+ "Create a new CiviCRM Module-Extension (Regenerate module.civix.php if \"key\" is not specified)\n" .
"\n" .
"Identification:\n" .
- " Keys must be lowercase alphanumeric (with dashes and underscores allowed).\n" .
+ " Keys should be lowercase alphanumeric with underscores. Dots and dashes may be used with caveats.\n" .
"\n" .
- " Optionally, you may use a Java-style prefix (reverse domain name).\n" .
+ " CiviCRM extensions formally have two names, the \"key\" and the \"file\".\n" .
+ " Some APIs use the \"key\" name, and other APIs use the \"file\" name.\n" .
+ " The \"key\" allows a Java-style prefix (reverse domain name), but \"file\" does not.\n" .
"\n" .
- " However, the prefix is mostly cosmetic. The base part of the key should be globally unique.\n" .
+ " If you use a Java-style prefix (dots and dashes), then the extension will have split names.\n" .
+ "\n" .
+ " If you omit a Java-style prefix (dots and dashes), then the extension will have a single (matching) name.\n" .
"\n" .
"Examples:\n" .
- " civix generate:module foo-bar\n" .
- " civix generate:module foo-bar --license=AGPL-3.0 --author=\"Alice\" --email=\"alice@example.org\"\n" .
+ " civix generate:module foo_bar\n" .
+ " civix generate:module foo_bar --license=AGPL-3.0 --author=\"Alice\" --email=\"alice@example.org\"\n" .
" civix generate:module org.example.foo-bar \n" .
"\n"
);
@@ -103,6 +107,30 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('Unrecognized license (' . $ctx['license'] . ')');
return;
}
+
+ if ($ctx['fullName'] !== $ctx['mainFile']) {
+ $output->writeln("");
+ $output->writeln("ALERT: The requested command requires split-naming.");
+ $output->writeln("");
+ $output->writeln("CiviCRM extensions formally have two names, the \"key\" and the \"file\".");
+ $output->writeln("Some APIs use the \"key\" name, and other APIs use the \"file\" name.");
+ $output->writeln("");
+ $output->writeln(" \"Key\": Appears in many strings+indices. Allows Java-style prefix.");
+ $output->writeln(" Requested Value: {$ctx['fullName']}");
+ $output->writeln(" Example Usage: addStyleFile('{$ctx['fullName']}', 'example.css')");
+ $output->writeln(" \"File\": Appears in PHP files+functions. No Java-style prefix.");
+ $output->writeln(" Requested Value: {$ctx['mainFile']}");
+ $output->writeln(" Example Usage: function {$ctx['mainFile']}_civicrm_config() {}");
+ $output->writeln("");
+ $output->writeln("Many developers find it easier to use matching names, but the");
+ $output->writeln("requested command requires splitting the names. You may continue with");
+ $output->writeln("split names, or you may cancel and try again with a simpler name.");
+ $output->writeln("");
+ if (!$this->confirm($input, $output, "Continue with current (split) name? [Y/n] ")) {
+ return 1;
+ }
+ }
+
$ext = new Collection();
$output->writeln("Initalize module " . $ctx['fullName'] . "");