Closed motin closed 10 years ago
Removed generate
since it overlaps with interactive
and would cause confusion. It was there because the original code was copied from previous PR.
@qiangxue: What is a more appropriate option name? --overwrite=y
like in ./init
? --overwrite=1
so that it stays a boolean? (Overwriting files on --interactive=0
seems a bit dangerous.)
I think we can leave it as is unless there are more requests for change of the behavior. It depends on in which case you would use --interactive=0
.
Currently gii cli can't overwrite files in non-interactive mode. This makes it cumbersome to re-generate models and crud in an automated or scripted manner. Using --interactive=0
today is more like a --dry-run=1
option, since it shows changes but does not overwrite anything. Should we make --interactive=0
overwrite files by default and add a --dry-run
option instead for the current behavior?
Wll there be another possibility to regenerate all files?
I think this line: https://github.com/yiisoft/yii2/blob/master/extensions/gii/console/GenerateAction.php#L59
should read:
$skipAll = $this->controller->interactive ? null : false;
Which would regenerate all files if running in non-interactive mode.
@schmunk42: Yes, that would make --interactive=0
overwrite files by default. Even better than having a separate confusing --generate
option. Personally I don't need the --dry-run
options, since it is easy to revert all changes files using git.
@qiangxue In which case do you need this? continued
For generating a batch of models and CRUDs during very early development. It's very cumbersome to manually use y
or ya
when there are a lot of changes in many models. But this applies for all Gii actions which may overwrite a large number of files.
Fixed. Thanks.
@qiangxue: Great! Thanks for the quick turnaround :)
Phpdoc claim: https://github.com/yiisoft/yii2/blob/7324f21dca2792f343ad1ad86122d123f3767616/extensions/gii/console/GenerateController.php#L35-L37
In reality, running any gii command in cli with
--generate=1
results in:When support for this option is added to cli, the option is ignored and gii will ask for confirmation before overwriting files, despite using
--interactive=0
.Suggested solution:
--generate
option--interactive=0
and--generate=1
--generate
option when--interactive=1
A PR is on it's way.