-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[NFR] Examples and docs about cli modules #411
Comments
Another way i thought about: ./script.php robot/create --color=red --feature=weapon and to get this inside my application with controllers, actions, etc in this way: controller: robot |
We have four classes, that are prepared especially for CLI:
What i really can't get - is phalcon able to get and handle argv parameters manually, and those classes should work in group. Perhaps you will find some little amount of time to describe this shortly. I believe that with Phalcon my CLI app will look much nicer then without it :) Thanks in advance |
I've added my example here: |
One bad thing: cli/console is accepting all parameters as action names, for example: ./app.php test --param1=value1 --param2=value2 Will output: How it is possible to get params for specified action? |
It's also impossible to pass parameters as: ./script.php testtask?param=value ./script.php testtask -param |
If i specity parameters following way: ./app.php test test --param=value in test task i have following code: public function testAction()
{
var_dump($this->dispatcher->getParams());
} i will get following values:
How to get array keys as param names and array values as param values? |
If i specify parameters divided by a space, i will get them as separate params:
How it is possible to get array as following?
|
Was unable find the way for this in the end. Finally stopped at solution to define parameters in action methods, like this: public function doSmth($param1, $param2) This works fine. Perhaps it's a good idea for NFR to implement param=value or --param=value, which will look more native in cli? |
I found that there are some CLI classes. Perhaps you could spend some time on tutorials about writing cli applications with such modules....
If writing cli applications would be simple as writing micro applications it would be unbeliveable.
Perhaps, i need to make cli application, that accepts parameters in the following way:
cli-app.php $command --param1=value1 --param2=value2
If it would be possible to handle such requests automatically and focus on business logic, it would ecomony many time :)
The text was updated successfully, but these errors were encountered: