Make YII_CONSOLE_COMMANDS available for framework yiic command

Hi,

I would like to run a custom command from the default framework installation via yiic.

Since the current yiic does not make use YII_CONSOLE_COMMANDS if you do not include a $config I can’t create my custom application skeleton (with the config).

This would be my requested feature, yiic should simply take a look in the YII_CONSOLE_COMMANDS path:


Index: framework/yiic.php

===================================================================

--- framework/yiic.php	(Revision 3332)

+++ framework/yiic.php	(Arbeitskopie)

@@ -19,15 +19,15 @@


require_once(dirname(__FILE__).'/yii.php');


-if(isset($config))

-{

+if(isset($config)) {

	$app=Yii::createConsoleApplication($config);

	$app->commandRunner->addCommands(YII_PATH.'/cli/commands');

-	$env=@getenv('YII_CONSOLE_COMMANDS');

-	if(!empty($env))

-		$app->commandRunner->addCommands($env);

}

else

	$app=Yii::createConsoleApplication(array('basePath'=>dirname(__FILE__).'/cli'));


+$env=@getenv('YII_CONSOLE_COMMANDS');

+if(!empty($env))

+    $app->commandRunner->addCommands($env);

+

$app->run();

\ No newline at end of file

It would be also an alternative if I could specify the commandPath for yiic, like


$ /path/to/yii/framework/yiic --commandPath=/path/to/my/commands p3webapp p3

Any objections?

Best regards,

schmunk

Bump!

Hi guys,

the use-case would be:

I want to create a custom webapp with yiic, but I don’t want to use the existing directory structure, so I have to create my own command.

Is there any way to specify a command, which is not included in the Yii Framework download?

Can I set $config manually when running yiic or yiic.bat.

Please help.

Thanks & best regards,

schmunk

Any progress with this?

I’m too want to add a custom command to create a different skeleton webapp.

Pull request here: https://github.com/yiisoft/yii/pull/967

While I usually just copy and modify the webapp command plus create a new template dir in cli/views, it would be better if we could add our own yiic command paths so that we don’t taint the Yii installation.

+1 for this feature request.

I talked with Alex about this already.

Could you propose a simple, non-confusing way, an example, how we can do this?

I don’t think it should be modified to grok YII_CONSOLE_COMMANDS by default…

How about letting it accept an additional command line argument instead?

That way, if no extra argument is provided, it would default to current behavior.

Why?

Was also my first idea, but seemed to be too user confusing.

Then how about allowing us to specify the command with absolute path?


yiic /home/jacmoe/yiicmds/webapp args

In addition to YII_CONSOLE_COMMANDS, I mean.

Feel free to write a pull request. But I won’t decide about the final outcome ;)