Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to force a command to autorun? #2

Open
calevans opened this issue Aug 18, 2012 · 3 comments
Open

Is there a way to force a command to autorun? #2

calevans opened this issue Aug 18, 2012 · 3 comments
Labels

Comments

@calevans
Copy link

@calevans calevans commented Aug 18, 2012

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=

@cordoval
Copy link

@cordoval cordoval commented Aug 18, 2012

=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!

@EastHullMike
Copy link

@EastHullMike EastHullMike commented Oct 17, 2014

£

@ghost
Copy link

@ghost ghost commented Jun 1, 2016

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

@ghost ghost self-assigned this Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants