Skip to content

Commit

Permalink
Add zopectl.command commands
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
gforcada committed Jan 16, 2016
1 parent d7ce4a1 commit 27004df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Changelog
4.2.19 (unreleased)
-------------------

- Nothing changed yet.
- Handle commands registered for zopectl as well,
up to now they were handled but not displayed at all
(ie in help and descriptions).
https://github.com/plone/plone.recipe.zope2instance/issues/18
[gforcada]


4.2.18 (2015-07-27)
Expand Down
9 changes: 9 additions & 0 deletions src/plone/recipe/zope2instance/ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,15 @@ def main(args=None):
if func_name not in dir(c):
setattr(c.__class__, func_name, func)

# Mix in any additional commands supplied by other packages
# registered for zopectl:
for ep in iter_entry_points('zopectl.command'):
func_name = 'do_' + ep.name
func = ep.load()
# avoid overwriting the standard commands
if func_name not in dir(c):
setattr(c.__class__, func_name, func)

# If a command was specified: call the corresponding do_*() method.
#
# If that method set an exit status, exit this Python script
Expand Down

2 comments on commit 27004df

@gweis
Copy link
Member

@gweis gweis commented on 27004df Mar 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the way how zopectl.command entrypoints are called. The old behaviour was, that Zope2.Startup.zopectl run_entrypoint splits the argument string into an array, but with this, the run_entrypoint method will be bypassed and the whole list of arguments will be passed as a single string (additionally it no longer passes entrypoint name as first entry in args to func.)

@gforcada
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gweis yes you are right, I noticed that on collective.solr already. I will revert to the old behavior.

Please sign in to comment.