-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Flags should have consitent api #1634
Flags should have consitent api #1634
Conversation
Thanks for the review @shadowhand I have cleaned this up based on your suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much cleaner, good stuff!
Any thoughts on this one @mnapoli ? |
Hey, sorry for the delay. Big PRs are always harder to merge than simple ones 😬 There was a misunderstanding on my side, that's my fault. In the initial conversation, you mentioned 2 changes:
I only considered the first suggestion, and I think solving this "bug" is great. Regarding the second proposition, I'm not convinced. Yes, having consistency in flags could be good in theory, but:
The Node world has a poor ecosystem for dealing with CLI flags and arguments. That's why they almost always use options ( So here's why I'm really hesitant to merge this:
All this is adding up. I'm sorry because of the time you invested in the PR, but I don't think it's worth merging in its current state 😬 Hope that makes sense. I think the best option would be to only solve the 1st problem ( |
Thanks for the detailed feedback. @mnapoli I'm not sure if it is possible to solve just the first issue using |
Closing inactive PRs, feel free to reopen. |
PR closes #1628 and is a follow on from the initial implementation of the
--path
flag merged in #1627Provides a suite of CLI flags for local invocation of Bref event driven functions when not utilising Serverless framework. This makes the API for invoking event driven Bref functions consistent with running local functions using
serverless bref:local
Available flags
Backward compatability
Backward compatibility with the current way to invoke bref-local
has been maintained so calling via
vendor/bin/bref-local <handler> <event-data>
will continue to work. Essentially, flags are 100% opt in.Ordering of flags
The order of flags is now irrelevant and any combination of either
-f && --path
or-f && --data
will be accepted as valid invocations.Tested commands
I have tested invoking functions using
bref-local
in the following combinations.Backward compatible commands
✅
$ vendor/bin/bref-local index.php
-> Hello World
✅
$ vendor/bin/bref-local index.php '{"name": "Fred"}'
-> Hello Fred
Flag based commands
✅
$ vendor/bin/bref-local -f index.php
-> Hello World
✅
$ vendor/bin/bref-local -f index.php --path event.json
-> Hello Fred
✅
$ vendor/bin/bref-local -f index.php --data '{"name": "Alex"}'
-> Hello Alex
✅
$ vendor/bin/bref-local --path event.json -f index.php
-> Hello Fred
✅
$ vendor/bin/bref-local --data '{"name": "Alex"}' -f index.php
-> Hello Alex