-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add --targets to CLI #335
Add --targets to CLI #335
Conversation
Looks good to me. Maybe we need some tests for this? |
I'll setup a test for |
Looks good to me. @mottosso ? |
pyblish/api.py
Outdated
@@ -151,6 +151,11 @@ def __init__(): | |||
if host: | |||
register_host(host) | |||
|
|||
# Register targets for current session | |||
for t in os.environ.get("PYBLISH_TARGETS", "").split(os.pathsep): |
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.
This is too short of a variable name.
Can we also make it..
if not target:
continue
register_target(target)
To reduce indentation?
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.
Alternatively..
register_target(target) if target else None
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.
If I do that then I want to change the lines (line 150) above it as well to have consistency.
I used this as a template to ensure the logic would be the same:
# Register hosts from environment "PYBLISHHOSTS"
for host in os.environ.get("PYBLISH_HOSTS", "").split(os.pathsep):
if host:
register_host(host)
These lines would then become:
# Register hosts from environment "PYBLISHHOSTS"
for host in os.environ.get("PYBLISH_HOSTS", "").split(os.pathsep):
if not host:
continue
register_host(host)
Agreed?
Ok, with that minor tweak I'm happy. |
Thanks! |
Solves #334
--targets
throughpublish
PYBLISH_TARGETS
env variableif targets are found register them with the API