Commits

Anonymous committed d29f26d

Add docs for pre_workon

Comments (0)

Files changed (1)

docs/source/plugins.rst

 
 The API is the same for every extension point.  Each uses a Python
 function that takes a single argument, a list of strings passed to the
-hook loader on the command line.  
+hook loader on the command line.
 
 ::
 
     def initialize(args):
         for filename, comment in GLOBAL_HOOKS:
             make_hook(os.path.join('$WORKON_HOME', filename), comment)
-        return 
+        return
 
 .. _plugins-user-env:
 
     where examining the ``SHELL`` environment variable to generate
     different syntax for each case is the only way to achieve the
     desired result.
-    
+
 Registering Entry Points
 ------------------------
 
 configured.
 
 ::
-    
+
     # Bootstrap installation of Distribute
     import distribute_setup
     distribute_setup.use_setuptools()
-    
+
     from setuptools import setup
-    
+
     setup(
         name = 'virtualenvwrapper',
         version = '2.0',
-        
+
         description = 'Enhancements to virtualenv',
-    
+
         # ... details omitted ...
 
         namespace_packages = [ 'virtualenvwrapper' ],
-    
+
         entry_points = {
             'virtualenvwrapper.initialize': [
                 'user_scripts = virtualenvwrapper.user_scripts:initialize',
             'virtualenvwrapper.initialize_source': [
                 'user_scripts = virtualenvwrapper.user_scripts:initialize_source',
                 ],
-    
+
             # ... details omitted ...
             },
         )
 
   $ python -m virtualenvwrapper.hook_loader -h
   Usage: virtualenvwrapper.hook_loader [options] <hook> [<arguments>]
-  
+
   Manage hooks for virtualenvwrapper
-  
+
   Options:
     -h, --help            show this help message and exit
     -s, --source          Print the shell commands to be run in the current
     -q, --quiet           Show less information on the console
     -n NAMES, --name=NAMES
                           Only run the hook from the named plugin
-  
+
 To run the extensions for the initialize hook::
 
   $ python -m virtualenvwrapper.hook_loader -v initialize
 environment is disabled.  The name of the environment just deactivated
 is passed as the first argument.
 
+.. _plugins-pre_workon:
+
+pre_workon
+---------------
+
+The ``virtualenvwrapper.pre_workon`` hooks are run just before an
+environment is looked up to be activated. This hook is called
+regardless of whether or not the environment exists. The name of the
+environment that is being looked up is passed as the first argument.
+
 .. _plugins-pre_rmvirtualenv:
 
 pre_rmvirtualenv
 points.  No setup needs to be done to allow the hook loader to find
 the extensions; documenting the names and adding calls to
 ``virtualenvwrapper_run_hook`` is sufficient to cause them to be
-invoked.  
+invoked.
 
 The hook loader assumes all extension point names start with
 ``virtualenvwrapper.`` and new plugins will want to use their own