Table of Contents

Class: Bootstrap ./src/peak/running/commands.py

Invoke and use an arbitrary IExecutable object

This class is designed to allow specification of an arbitrary name or URL on the command line to retrieve and invoke the designated object.

If the name is not a scheme-prefixed URL, it is first converted to a name in the peak.running.shortcuts configuration property namespace, thus allowing simpler names to be used. For example, runIni is a shortcut for "import:peak.running.commands:IniInterpreter". If you use a sitewide PEAK_CONFIG file, you can add your own shortcuts to the peak.running.shortcuts namespace. (See the peak.ini file for current shortcuts, and examples of how to define them.)

The object designated by the name or URL in 'argv[1]' must be an 'IExecutable'; that is to say it must implement one of the IExecutable sub-interfaces, or else be callable without arguments. (See the running.IExecutable interface for more details.)

Here's an example bootstrap script (which is installed as the peak script by the PEAK distribution on posix operating systems):

        #!/usr/bin/env python2.2

        from peak.running.commands import Bootstrap
        from peak.api import config
        import sys

        sys.exit(
            Bootstrap(
                config.makeRoot()
            ).run()
        )

The script above will look up its first supplied command line argument, and then invoke the found object as a command, supplying the remaining command line arguments.

Base Classes   
AbstractInterpreter
Methods   
interpret
showHelp
  interpret 
interpret ( self,  name )

Exceptions   
InvocationError( "Invalid command object", factory, "found at", name )
  showHelp 
showHelp ( self )

Display usage message on stderr


Table of Contents

This document was automatically generated on Tue Feb 17 19:55:49 2004 by HappyDoc version 2.1