yiisoft/yii2 — pull request #2789 by schmunk42 (2014-03-18 04:39:29+00:00)
Title: gii command

## Draft

First off all I had a problem defining `gii` as a module for the console, it looks like the default controller is recognized as a command, so I had to configure the module as `console-gii` temporarily.

Sample output
```
$ ./yii

[...]
- console-gii/default @author Qiang Xue
```

The command works like this:
```

$ ./yii gii/generate --generator=module --generate=true \
--attributes='template:default;moduleClass:app\modules\foobar\Module;moduleID:foobar'
Loading generator 'module'...

Generating code using template "/Users/tobias/hrzg/gitlab/phundament/app-local-v4/vendor/yiisoft/yii2-dev/extensions/gii/generators/module/default"...
generated modules/foobar/Module.php
generated modules/foobar/controllers/DefaultController.php
generated modules/foobar/views/default/index.php
done!
```

Custom generator:
```
$ ./yii gii/generate --generator=giiant --generate=true \
--attributes='template:default;modelClass:app\models\TestBase;searchModelClass:app\models\TestBaseSearch;controllerClass:app\controllers\TestBaseController;providerList:\schmunk42\giiant\crud\providers\EditorProvider,\schmunk42\giiant\crud\providers\SelectProvider'

Loading generator 'giiant'...

Generating code using template "/Users/tobias/hrzg/gitlab/phundament/app-local-v4/vendor/schmunk42/yii2-giiant/crud/default"...
skipped controllers/TestBaseController.php
skipped models/TestBaseSearch.php
overwrote views/test-base/_form.php
skipped views/test-base/_search.php
skipped views/test-base/create.php
skipped views/test-base/index.php
skipped views/test-base/update.php
skipped views/test-base/view.php
done!
```

Error output:
```
Errors:
-------
template: A code template must be selected.
modelClass: Model Class cannot be blank.
searchModelClass: Search Model Class cannot be blank.
controllerClass: Controller Class cannot be blank.
```

It can run the creation process and generate the files. Let me know what you think about the syntax.
If we can run commands from commands there's no need for a config file loader immediately.
I'll also try to implement the interactive fallback, if this approach is OK so far.