-
Notifications
You must be signed in to change notification settings - Fork 198
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
b3bp sourced mode #61
Conversation
This "sourced mode" does not change any behaviour of the script The new script If |
If main.sh is being sourced instead of being executed it respects the variables __usage and __helptext being defined beforehand. Its behaviour will depend on the sourcing script. If __usage is defined but empty no argument parsing is done. If __helptext is defined but empty no helptext will be shown. Logging support still exists as it did before. The environment variables LOG_LEVEL and NO_COLOR are supported just as they were before.
if you are not totally against this PR i would go ahead and add tests for example.sh to cover this new sourced mode. also updating the documentation pointing out this new way of using b3bp would come your way. |
This looks great, would allow me to integrate my usage of b3bp.sh more tightly with upstream |
that is the exact reason why i so furiously worked on all this changes ( #56 #57 and now #61 ). b3bp is really the boilerplate i need every time i start a new shell script. so much worked saved by just using it. but i am not a big fan of that copy-modify approach. what happens there is that you end up with 20 scripts which all started out as a copy of a different |
LGTM |
Oh and btw.. i would even go so far as to rename |
Thanks for your work @mstreuhofer!
I need to think about that for a bit, I'm not immediately against it, I can say that. |
If main.sh is being sourced instead of being executed it respects the
variables __usage and __helptext being defined beforehand. Its behaviour
will depend on the sourcing script. If __usage is defined but empty no
argument parsing is done. If __helptext is defined but empty no helptext
will be shown.
Logging support still exists as it did before. The environment variables
LOG_LEVEL and NO_COLOR are supported just as they were before.