IMP Reference Guide
develop.714915d50b,2024/12/07
The Integrative Modeling Platform
|
Allow command line tools to easily implement multiple commands. More...
Allow command line tools to easily implement multiple commands.
Typically, an IMP command line tool will use an instance of this class to provide a consistent interface to multiple distinct commands from a single binary, rather than providing a potentially large number of binaries. This is similar to the way a number of common command line tools outside of IMP function (e.g. Git provides a single git
tool which implements multiple commands - git add
, git commit
, git push
and so on).
Each command is implemented with a Python module of the same name that can be imported from the module (for example, if module_name
is IMP.foo
, the bar
command is provided by the IMP.foo.bar
Python module, which would usually be found as modules/foo/pyext/src/bar.py
). Each such module should have a docstring and a main()
method that takes no arguments (the module should also call its main()
method if it is run directly, i.e. with something like if __name__=="__main__": main()
). The encompassing module (IMP.foo
in the example) should define _all_commands
as a Python list of all valid commands.
See the multifit
and cnmultifit
command line tools for example usage.
Definition at line 9302 of file __init__.py.
Public Member Functions | |
def | __init__ |
Constructor. More... | |
def | main |
Call this method to act upon the user-provided command line. More... | |
def IMP.CommandDispatcher.__init__ | ( | self, | |
short_help, | |||
long_help, | |||
module_name | |||
) |
Constructor.
short_help | A few words that describe the command line tool. |
long_help | Longer text, used in the help command. |
module_name | Name of the module (e.g. IMP.foo ) that implements the commands. |
Definition at line 9327 of file __init__.py.
def IMP.CommandDispatcher.main | ( | self | ) |
Call this method to act upon the user-provided command line.
Definition at line 9340 of file __init__.py.