Skip to content

Commit 1f0152e

Browse files
committed
update command names
1 parent 0a82623 commit 1f0152e

File tree

1 file changed

+119
-46
lines changed

1 file changed

+119
-46
lines changed

src/Ubiquity/devtools/cmd/Command.php

Lines changed: 119 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function getInfo($cmd) {
125125
public static function project() {
126126
return new Command("project", "projectName", "Creates a new #ubiquity project.", [
127127
"new",
128-
"create-project"
128+
"create_project"
129129
], [
130130
"b" => Parameter::create("dbName", "Sets the database name.", []),
131131
"s" => Parameter::create("serverName", "Defines the db server address.", [], "127.0.0.1"),
@@ -153,7 +153,10 @@ public static function project() {
153153

154154
public static function controller() {
155155
return new Command("controller", "controllerName", "Creates a new controller.", [
156-
"create-controller"
156+
'create_controller',
157+
'create:controller',
158+
'create-controller',
159+
'createController'
157160
], [
158161
"v" => Parameter::create("views", "creates an associated view folder and index.html", [
159162
"true",
@@ -169,7 +172,10 @@ public static function controller() {
169172

170173
public static function model() {
171174
return new Command("model", "tableName", "Generates a new model.", [
172-
"create-model"
175+
'create_model',
176+
'create:model',
177+
'create-model',
178+
'createModel'
173179
], [
174180
'd' => Parameter::create('database', 'The database connection to use', [], 'default'),
175181
'a' => Parameter::create('access', 'The default access to the class members', [], 'private'),
@@ -182,9 +188,11 @@ public static function model() {
182188
}
183189

184190
public static function routes() {
185-
return new Command("info:routes", "", "Display the cached routes.", [
186-
"info:r",
187-
"info::routes"
191+
return new Command("info-routes", "", "Display the cached routes.", [
192+
'info:r',
193+
'info_routes',
194+
'info:routes',
195+
'infoRoutes'
188196
], [
189197
"t" => Parameter::create("type", "Defines the type of routes to display.", [
190198
"all",
@@ -214,7 +222,10 @@ public static function version() {
214222

215223
public static function allModels() {
216224
return new Command("all-models", "", "Generates all models from database.", [
217-
"create-all-models"
225+
'create-all-models',
226+
'all_models',
227+
'all:models',
228+
'allModels'
218229
], [
219230
'd' => Parameter::create('database', 'The database connection to use (offset)', [], 'default'),
220231
'a' => Parameter::create('access', 'The default access to the class members', [], 'private'),
@@ -227,7 +238,11 @@ public static function allModels() {
227238
}
228239

229240
public static function clearCache() {
230-
return new Command("clear-cache", "", "Clear models cache.", [], [
241+
return new Command("clear-cache", "", "Clear models cache.", [
242+
'clear_cache',
243+
'clear:cache',
244+
'clearCache'
245+
], [
231246
"t" => Parameter::create("type", "Defines the type of cache to reset.", [
232247
"all",
233248
"annotations",
@@ -244,7 +259,11 @@ public static function clearCache() {
244259
}
245260

246261
public static function initCache() {
247-
return new Command("init-cache", "", "Init the cache for models, router, rest.", [], [
262+
return new Command("init-cache", "", "Init the cache for models, router, rest.", [
263+
'init_cache',
264+
'init:cache',
265+
'initCache'
266+
], [
248267
"t" => Parameter::create("type", "Defines the type of cache to create.", [
249268
"all",
250269
"controllers",
@@ -306,7 +325,10 @@ public static function help() {
306325

307326
public static function crudController() {
308327
return new Command("crud", "crudControllerName", "Creates a new CRUD controller.", [
309-
"crud-controller"
328+
'crud_controller',
329+
'crud:controller',
330+
'crud-controller',
331+
'crudController'
310332
], [
311333
"r" => Parameter::create("resource", "The model used", []),
312334
"d" => Parameter::create("datas", "The associated Datas class", [
@@ -338,7 +360,10 @@ public static function crudController() {
338360

339361
public static function indexCrudController() {
340362
return new Command("crud-index", "crudControllerName", "Creates a new index-CRUD controller.", [
341-
"crud-index-controller"
363+
'crud-index-controller',
364+
'crud_index',
365+
'crud:index',
366+
'crudIndex'
342367
], [
343368
"d" => Parameter::create("datas", "The associated Datas class", [
344369
"true",
@@ -359,9 +384,7 @@ public static function indexCrudController() {
359384
"item",
360385
"itemHome"
361386
], "index,form,display,home,itemHome"),
362-
"p" => Parameter::create("path", "The associated route", [
363-
'{resource}'
364-
]),
387+
"p" => Parameter::create("path", "The associated route", [], '{resource}'),
365388
'o' => Parameter::create('domain', 'The domain in which to create the controller.', [], '')
366389
], [
367390
'Creates an index crud controller' => 'Ubiquity crud-index MainCrud -p=crud/{resource}',
@@ -371,7 +394,10 @@ public static function indexCrudController() {
371394

372395
public static function restController() {
373396
return new Command("rest", "restControllerName", "Creates a new REST controller.", [
374-
"rest-controller"
397+
'rest-controller',
398+
'rest:controller',
399+
'rest_controller',
400+
'restController'
375401
], [
376402
"r" => Parameter::create("resource", "The model used", []),
377403
"p" => Parameter::create("path", "The associated route", [])
@@ -382,7 +408,10 @@ public static function restController() {
382408

383409
public static function restApiController() {
384410
return new Command("restapi", "restControllerName", "Creates a new REST API controller.", [
385-
"restapi-controller"
411+
'restapi-controller',
412+
'restapi:controller',
413+
'restapi_controller',
414+
'restapiController'
386415
], [
387416
"p" => Parameter::create("path", "The associated route", [])
388417
], [
@@ -410,7 +439,10 @@ public static function dao() {
410439

411440
public static function authController() {
412441
return new Command("auth", "authControllerName", "Creates a new controller for authentification.", [
413-
"auth-controller"
442+
'auth-controller',
443+
'auth_controller',
444+
'auth:controller',
445+
'authController'
414446
], [
415447
"e" => Parameter::create("extends", "The base class of the controller (must derived from AuthController)", [], "Ubiquity\\controllers\\auth\\AuthController"),
416448
"t" => Parameter::create("templates", "The templates to modify", [
@@ -431,7 +463,10 @@ public static function authController() {
431463

432464
public static function newAction() {
433465
return new Command("action", "controller.action", "Creates a new action in a controller.", [
434-
"new-action"
466+
'new-action',
467+
'new_action',
468+
'new:action',
469+
'newAction'
435470
], [
436471
"p" => Parameter::create("params", "The action parameters (or arguments)", []),
437472
"r" => Parameter::create("route", "The associated route path", []),
@@ -449,9 +484,24 @@ public static function newAction() {
449484
], 'controllers');
450485
}
451486

487+
public static function newDomain() {
488+
return new Command('domain', 'name', 'Creates a new domain (for a Domain Driven Design approach).', [
489+
'new-domain',
490+
'new_domain',
491+
'new:domain',
492+
'newDomain'
493+
], [
494+
"b" => Parameter::create("base", "The base folder for domains.", [], 'domains')
495+
], [
496+
'Creates a new domain users' => 'Ubiquity domain users'
497+
], 'controllers');
498+
}
499+
452500
public static function infoModel() {
453-
return new Command("info:model", "?infoType", "Returns the model meta datas.", [
454-
"info-model"
501+
return new Command("info-model", "?infoType", "Returns the model meta datas.", [
502+
'info_model',
503+
'info:model',
504+
'infoModel'
455505
], [
456506
"s" => Parameter::create("separate", "If true, returns each info in a separate table", [
457507
"true",
@@ -466,8 +516,10 @@ public static function infoModel() {
466516
}
467517

468518
public static function infoModels() {
469-
return new Command("info:models", "", "Returns the models meta datas.", [
470-
"info-models"
519+
return new Command('info-models', '', 'Returns the models meta datas.', [
520+
'info_models',
521+
'info:models',
522+
'infoModels'
471523
], [
472524
'd' => Parameter::create('database', 'The database connection to use (offset)', [], 'default'),
473525
"m" => Parameter::create("models", "The models on which the information is sought.", []),
@@ -482,10 +534,14 @@ public static function infoModels() {
482534
}
483535

484536
public static function infoValidation() {
485-
return new Command("info:validation", "?memberName", "Returns the models validation info.", [
486-
"info-validation",
487-
"info:validators",
488-
"info-validators"
537+
return new Command("info-validation", "?memberName", "Returns the models validation info.", [
538+
'info_validation',
539+
'info:validation',
540+
'infoValidation',
541+
'info_validators',
542+
'info-validators',
543+
'info:validators',
544+
'infoValidators'
489545
], [
490546
"s" => Parameter::create("separate", "If true, returns each info in a separate table", [
491547
'true',
@@ -501,8 +557,10 @@ public static function infoValidation() {
501557

502558
public static function configInfo() {
503559
return new Command("config", "", "Returns the config informations from app/config/config.php.", [
504-
"info-config",
505-
"info:config"
560+
'info_config',
561+
'info-config',
562+
'info:config',
563+
'infoConfig'
506564
], [
507565
"f" => Parameter::create("fields", "The fields to display.", [])
508566
], [
@@ -512,10 +570,11 @@ public static function configInfo() {
512570
}
513571

514572
public static function configSet() {
515-
return new Command("config:set", "", "Modify/add variables and save them in app/config/config.php. Supports only long parameters with --.", [
516-
"info-set",
517-
"set:config",
518-
"set-config"
573+
return new Command("config-set", "", "Modify/add variables and save them in app/config/config.php. Supports only long parameters with --.", [
574+
'set_config',
575+
'set-config',
576+
'set:config',
577+
'setConfig'
519578
], [], [
520579
'Assigns a new value to siteURL' => 'Ubiquity config:set --siteURL=http://127.0.0.1/quick-start/',
521580
'Change the database name and port' => 'Ubiquity config:set --database.dbName=blog --database.port=3307'
@@ -524,7 +583,9 @@ public static function configSet() {
524583

525584
public static function newTheme() {
526585
return new Command("create-theme", "themeName", "Creates a new theme or installs an existing one.", [
527-
"create:theme"
586+
'create_theme',
587+
'create:theme',
588+
'createTheme'
528589
], [
529590
"x" => Parameter::create("extend", "If specified, inherits from an existing theme (bootstrap,semantic or foundation).", [
530591
'bootstrap',
@@ -539,8 +600,10 @@ public static function newTheme() {
539600

540601
public static function installTheme() {
541602
return new Command("theme", "themeName", "Installs an existing theme or creates a new one if the specified theme does not exists.", [
542-
"install-theme",
543-
"install:theme"
603+
'install_theme',
604+
'install-theme',
605+
'install:theme',
606+
'installTheme'
544607
], [], [
545608
'Creates a new theme custom' => 'Ubiquity theme custom',
546609
'Install bootstrap theme' => 'Ubiquity theme bootstrap'
@@ -575,20 +638,24 @@ public static function mailer() {
575638
}
576639

577640
public static function sendMails() {
578-
return new Command("sendMail", "", "Send message(s) from queue.", [
579-
"sendMails"
641+
return new Command("send-mail", "", "Send message(s) from queue.", [
642+
'send-mails',
643+
'send_mails',
644+
'send:mails',
645+
'sendMails'
580646
], [
581647
"n" => Parameter::create("num", "If specified, Send the mail at the position n in queue.", [])
582648
], [
583-
'Send all messages to send from queue' => 'Ubiquity semdmails',
584-
'Send the first message in queue' => 'Ubiquity sendmail 1'
649+
'Send all messages to send from queue' => 'Ubiquity semdMails',
650+
'Send the first message in queue' => 'Ubiquity sendMail 1'
585651
], 'mailer');
586652
}
587653

588654
public static function newMail() {
589655
return new Command("new-mail", "name", "Creates a new mailer class.", [
590-
"newMail",
591-
"new:mail"
656+
'new_mail',
657+
'new:mail',
658+
'newMail'
592659
], [
593660
"p" => Parameter::create("parent", "The class parent.", [], '\\Ubiquity\\mailer\\AbstractMail'),
594661
"v" => Parameter::create("view", "Add the associated view.", [], false)
@@ -598,10 +665,11 @@ public static function newMail() {
598665
}
599666

600667
public static function newClass() {
601-
return new Command("new-class", "name", "Creates a new class.", [
602-
"newClass",
603-
"new:class",
604-
"class"
668+
return new Command('new-class', "name", "Creates a new class.", [
669+
'new_class',
670+
'new:class',
671+
'newClass',
672+
'class'
605673
], [
606674
"p" => Parameter::create("parent", "The class parent.", [])
607675
], [
@@ -611,7 +679,8 @@ public static function newClass() {
611679

612680
public static function createCommand() {
613681
return new Command("create-command", "commandName", "Creates a new custom command for the devtools.", [
614-
"create:command",
682+
'create_command',
683+
'create:command',
615684
'createCommand'
616685
], [
617686
"v" => Parameter::create("value", "The command value (first parameter).", []),
@@ -625,6 +694,7 @@ public static function createCommand() {
625694

626695
public static function initAcls() {
627696
return new Command('acl-init', '', 'Initialize Acls defined with annotations in controllers.', [
697+
'acl_init',
628698
'acl:init',
629699
'aclInit'
630700
], [], [
@@ -634,6 +704,7 @@ public static function initAcls() {
634704

635705
public static function displayAcls() {
636706
return new Command('acl-display', '', 'Display Acls defined with annotations in controllers.', [
707+
'acl_display',
637708
'acl:display',
638709
'aclDisplay'
639710
], [
@@ -652,6 +723,7 @@ public static function displayAcls() {
652723

653724
public static function newEncryptionKey() {
654725
return new Command('new-key', 'cypher', 'Generate a new encryption key using a cipher.', [
726+
'new_key',
655727
'new:key',
656728
'newKey'
657729
], [], [
@@ -769,6 +841,7 @@ public static function getCommands() {
769841
self::initAcls(),
770842
self::displayAcls(),
771843
self::newEncryptionKey(),
844+
self::newDomain(),
772845
...self::getCustomCommandInfos()
773846
];
774847
}

0 commit comments

Comments
 (0)