Skip to content

Commit 4c96a9c

Browse files
committed
Update Command.php
1 parent 2ffe180 commit 4c96a9c

File tree

1 file changed

+63
-49
lines changed

1 file changed

+63
-49
lines changed

src/Ubiquity/devtools/cmd/Command.php

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,15 @@ public static function controller() {
155155
return new Command("controller", "controllerName", "Creates a new controller.", [
156156
"create-controller"
157157
], [
158-
"v" => Parameter::create("views", "creates an associated view folder", [
158+
"v" => Parameter::create("views", "creates an associated view folder and index.html", [
159159
"true",
160160
"false"
161-
], 'false')
161+
], 'false'),
162+
'o' => Parameter::create('domain', 'The domain in which to create the controller.', '')
162163
], [
163164
'Creates a controller' => 'Ubiquity controller UserController',
164-
'with its associated view' => 'Ubiquity controller UserController -v'
165+
'with its associated view' => 'Ubiquity controller UserController -v',
166+
'Creates a controller in the orga domain' => 'Ubiquity controller OrgaController -o=orga'
165167
], 'controllers');
166168
}
167169

@@ -170,7 +172,8 @@ public static function model() {
170172
"create-model"
171173
], [
172174
'd' => Parameter::create('database', 'The database connection to use', [], 'default'),
173-
'a' => Parameter::create('access', 'The default access to the class members', [], 'private')
175+
'a' => Parameter::create('access', 'The default access to the class members', [], 'private'),
176+
'o' => Parameter::create('domain', 'The domain in which to create the model.', '')
174177
], [
175178
'Ubiquity model User',
176179
'Ubiquity model Author -d=projects',
@@ -214,7 +217,8 @@ public static function allModels() {
214217
"create-all-models"
215218
], [
216219
'd' => Parameter::create('database', 'The database connection to use (offset)', [], 'default'),
217-
'a' => Parameter::create('access', 'The default access to the class members', [], 'private')
220+
'a' => Parameter::create('access', 'The default access to the class members', [], 'private'),
221+
'o' => Parameter::create('domain', 'The domain in which to create the models.', '')
218222
], [
219223
'Ubiquity all-models',
220224
'Ubiquity all-models -d=projects',
@@ -271,12 +275,15 @@ public static function serve() {
271275
'Starts a reactPHP server at 127.0.0.1:8080' => 'Ubiquity serve -t=react'
272276
], 'servers');
273277
}
274-
278+
275279
public static function liveReload() {
276-
return new Command("livereload", "path", "Start the live reload server.", ['live-reload','live'], [
280+
return new Command("livereload", "path", "Start the live reload server.", [
281+
'live-reload',
282+
'live'
283+
], [
277284
"p" => Parameter::create("port", "Sets the listen port number.", [], 35729),
278-
"e" => Parameter::create("exts", "Specify extentions to observe .", [],'php,html'),
279-
"x" => Parameter::create("exclusions", "Exclude file matching pattern .", [],'cache/,logs/')
285+
"e" => Parameter::create("exts", "Specify extentions to observe .", [], 'php,html'),
286+
"x" => Parameter::create("exclusions", "Exclude file matching pattern .", [], 'cache/,logs/')
280287
], [
281288
'Starts the live-reload server at 127.0.0.1:35729' => 'Ubiquity live-reload',
282289
'Starts the live-reload server at 127.0.0.1:35800 excluding logs directory' => 'Ubiquity live-reload -p=35800 -x=logs/'
@@ -327,35 +334,37 @@ public static function crudController() {
327334
'Creates a crud controller for the class models\projects\Author' => 'Ubiquity crud Authors -r=models\projects\Author'
328335
], 'controllers');
329336
}
330-
337+
331338
public static function indexCrudController() {
332-
return new Command("crud-index", "crudControllerName", "Creates a new index-CRUD controller.", [
333-
"crud-index-controller"
334-
], [
335-
"d" => Parameter::create("datas", "The associated Datas class", [
336-
"true",
337-
"false"
338-
], "true"),
339-
"v" => Parameter::create("viewer", "The associated Viewer class", [
340-
"true",
341-
"false"
342-
], "true"),
343-
"e" => Parameter::create("events", "The associated Events class", [
344-
"true",
345-
"false"
346-
], "true"),
347-
"t" => Parameter::create("templates", "The templates to modify", [
348-
"index",
349-
"form",
350-
"display",
351-
"item",
352-
"itemHome"
353-
], "index,form,display,home,itemHome"),
354-
"p" => Parameter::create("path", "The associated route", ['{resource}'])
355-
], [
356-
'Creates an index crud controller' => 'Ubiquity crud-index MainCrud -p=crud/{resource}',
357-
'allows customization of index and form templates' => 'Ubiquity index-crud MainCrud -t=index,form'
358-
], 'controllers');
339+
return new Command("crud-index", "crudControllerName", "Creates a new index-CRUD controller.", [
340+
"crud-index-controller"
341+
], [
342+
"d" => Parameter::create("datas", "The associated Datas class", [
343+
"true",
344+
"false"
345+
], "true"),
346+
"v" => Parameter::create("viewer", "The associated Viewer class", [
347+
"true",
348+
"false"
349+
], "true"),
350+
"e" => Parameter::create("events", "The associated Events class", [
351+
"true",
352+
"false"
353+
], "true"),
354+
"t" => Parameter::create("templates", "The templates to modify", [
355+
"index",
356+
"form",
357+
"display",
358+
"item",
359+
"itemHome"
360+
], "index,form,display,home,itemHome"),
361+
"p" => Parameter::create("path", "The associated route", [
362+
'{resource}'
363+
])
364+
], [
365+
'Creates an index crud controller' => 'Ubiquity crud-index MainCrud -p=crud/{resource}',
366+
'allows customization of index and form templates' => 'Ubiquity index-crud MainCrud -t=index,form'
367+
], 'controllers');
359368
}
360369

361370
public static function restController() {
@@ -387,7 +396,8 @@ public static function dao() {
387396
"c" => Parameter::create("condition", "The where part of the query", []),
388397
"i" => Parameter::create("included", "The associated members to load (boolean or array: client.*,commands)", []),
389398
"p" => Parameter::create("parameters", "The parameters for a parameterized query", []),
390-
"f" => Parameter::create("fields", "The fields to display in the response", [])
399+
"f" => Parameter::create("fields", "The fields to display in the response", []),
400+
'o' => Parameter::create('domain', 'The domain in which the models are.', '')
391401
], [
392402
'Returns all instances of models\User' => 'Ubiquity dao getAll -r=User',
393403
'Returns all instances of models\User and includes their commands' => 'Ubiquity dao getAll -r=User -i=commands',
@@ -426,7 +436,8 @@ public static function newAction() {
426436
"v" => Parameter::create("create-view", "Creates the associated view", [
427437
"true",
428438
"false"
429-
], "false")
439+
], "false"),
440+
'o' => Parameter::create('domain', 'The domain in which to create the models.', '')
430441
], [
431442
'Adds the action all in controller Users' => 'Ubiquity action Users.all',
432443
'Adds the action display in controller Users with a parameter' => 'Ubiquity action Users.display -p=idUser',
@@ -445,7 +456,8 @@ public static function infoModel() {
445456
"false"
446457
], "false"),
447458
"m" => Parameter::create("model", "The model on which the information is sought.", []),
448-
"f" => Parameter::create("fields", "The fields to display in the table.", [])
459+
"f" => Parameter::create("fields", "The fields to display in the table.", []),
460+
'o' => Parameter::create('domain', 'The domain in which the models is.', '')
449461
], [
450462
'Gets metadatas for User class' => 'Ubiquity info:model -m=User'
451463
], 'models');
@@ -457,7 +469,8 @@ public static function infoModels() {
457469
], [
458470
'd' => Parameter::create('database', 'The database connection to use (offset)', [], 'default'),
459471
"m" => Parameter::create("models", "The models on which the information is sought.", []),
460-
"f" => Parameter::create("fields", "The fields to display in the table.", [])
472+
"f" => Parameter::create("fields", "The fields to display in the table.", []),
473+
'o' => Parameter::create('domain', 'The domain in which the models are.', '')
461474
], [
462475
'Gets metadatas for all models in default db' => 'Ubiquity info:models',
463476
'Gets metadatas for all models in messagerie db' => 'Ubiquity info:models -d=messagerie',
@@ -476,7 +489,8 @@ public static function infoValidation() {
476489
'true',
477490
'false'
478491
], 'false'),
479-
"m" => Parameter::create("model", "The model on which the information is sought.", [])
492+
"m" => Parameter::create("model", "The model on which the information is sought.", []),
493+
'o' => Parameter::create('domain', 'The domain in which the models is.', '')
480494
], [
481495
'Gets validators for User class' => 'Ubiquity info:validation -m=User',
482496
'Gets validators for User class on member firstname' => 'Ubiquity info:validation firstname -m=User'
@@ -574,20 +588,20 @@ public static function newMail() {
574588
"newMail",
575589
"new:mail"
576590
], [
577-
"p" => Parameter::create("parent", "The class parent.", [],'\\Ubiquity\\mailer\\AbstractMail'),
578-
"v" => Parameter::create("view", "Add the associated view.", [],false)
591+
"p" => Parameter::create("parent", "The class parent.", [], '\\Ubiquity\\mailer\\AbstractMail'),
592+
"v" => Parameter::create("view", "Add the associated view.", [], false)
579593
], [
580594
'Creates a new mailer class' => 'Ubiquity newMail InformationMail'
581595
], 'mailer');
582596
}
583-
597+
584598
public static function newClass() {
585599
return new Command("new-class", "name", "Creates a new class.", [
586600
"newClass",
587601
"new:class",
588602
"class"
589603
], [
590-
"p" => Parameter::create("parent", "The class parent.",[])
604+
"p" => Parameter::create("parent", "The class parent.", [])
591605
], [
592606
'Creates a new class' => 'Ubiquity class services.OrgaRepository'
593607
], 'controllers');
@@ -633,8 +647,8 @@ public static function displayAcls() {
633647
'Display all defined roles with ACL annotations' => 'Ubiquity aclDisplay role'
634648
], 'security');
635649
}
636-
637-
public static function newEncryptionKey(){
650+
651+
public static function newEncryptionKey() {
638652
return new Command('new-key', 'cypher', 'Generate a new encryption key using a cipher.', [
639653
'new:key',
640654
'newKey'
@@ -720,7 +734,7 @@ public static function getCommands() {
720734
self::controller(),
721735
self::newAction(),
722736
self::authController(),
723-
self::indexCrudController(),
737+
self::indexCrudController(),
724738
self::crudController(),
725739
self::newClass(),
726740
self::newTheme(),

0 commit comments

Comments
 (0)