Closed theoboldalex closed 1 year ago
Hey, that sounds like a good idea. I'm not familiar with getopt
, so I'm not sure what the command will look like. If you add docs that will probably be clearer to me 👍
Great, I will work on the docs and update the PR in due course. Thanks
Thanks!
I have had another look at this and think it might actually be better to match the way we invoke locally with the way we would if using Serverless.
Serverless
serverless bref:local -f hello --path=event.json
CDK/TF
vendor/bin/bref-local -f my-function.php --path event.json
If you think that is worth doing, I follow up with another PR.
Thanks
Sorry I'm missing what would be different with what you implemented?
Apologies, I didn't explain very well above.
In the current implementation, when we pass the --path
flag, it must be passed before the handler file.
When running Bref with Serverless, the handler file has the -f
flag. I could add this to the non-Serverless bref-local
script to ensure consistency in how functions are invoked locally regardless of whether we are using Serverless, CDK or Terraform.
Oh yes that would be great indeed, in most PHP CLIs (artisan, Symfony Console) that's how it works. If you can do that without pulling in more dependencies that would be a very good improvement 👍
This change provides command line access to the
--path
flag where an application is built on AWS CDK rather than Serverless framework. This enables the passing of a path to a JSON file when runningvendor/bin/bref--local
instead of passing data as a string.If you agree with the premise of this change, I will also update the relevant documentation and include in the PR.