ConsoleServiceProvider icon indicating copy to clipboard operation
ConsoleServiceProvider copied to clipboard

Is there a way to force a command to autorun?

Open calevans opened this issue 13 years ago • 3 comments

I have a script using the ConsoleServiceProvider and I want it to auto run a command when I run it.

$app->register(new ConsoleServiceProvider(),
                array('console.name'              => 'ScanJobs',
                      'console.version'           => '1.0.0',
                      'console.project_directory' => __DIR__.'/..'));
$application = $app['console'];
$x = new ScanJobsCommand();
$x->addGeocodeer(new Geocode());
$application->add($x);
$application->run();

When run is called, I want it to execute a specific command. Is there a way to do this? right now I call the script with a parameter and it works fine. I just want to eliminate the parameter.

=C=

calevans avatar Aug 18 '12 16:08 calevans

=C= could you just write a wrapper of the command with that fixed in?

$application = $app['console'];
$x = new ScanJobsFixParameterCommand();
$x->addGeocodeer(new Geocode());
$application->add($x);
$application->run();

also don't call array('console.name' => 'ScanJobs', the console name ScanJobs as it confuses the other command with the console which are not the same

I would call it ConsoleForJobs :D

you rock man!

cordoval avatar Aug 18 '12 21:08 cordoval

£

EastHullMike avatar Oct 17 '14 10:10 EastHullMike

@calevans Did you come right with this? Do you need further assistance?

ghost avatar Jun 01 '16 05:06 ghost