{ "info": { "author": "Dustin Lacewell", "author_email": "dlacewell@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "capn\n====\n\ncapn is a package that provides hooks when the current-working-directory changes.\n\n### Installation\n\n $ sudo pip install capn\n $ touch ~/.capnhooks\n\n### Configuration\n\ncapn uses a simple YAML file for specifying paths and their hooks. As a quick example, consider the following:\n\n\n settings:\n default_type: path\n external_hooks:\n - ~/.otherhooks\n hooks:\n - path: /home\n type: tree\n enter: \n - echo entering /home\n exit: \n - echo exiting /home\n - echo /home waves goodbye\n\n - path: ~/\n enter: \n - echo entering ~/\n exit: \n - echo exiting ~/\n\nThe above establish enter and exit hooks for the two listed directories. As you change directories you should see output indicating each hook's execution. You'll notice that the */home* path has a **type** key with the value **tree**. There are two types of hooks; **path**, which is the default, only triggers for that absolute path. **tree** hooks will trigger when you enter or leave the tree below the specified path. Moving between child-paths below the tree does _not_ trigger the hooks. For example, moving from */ -> /home* would trigger the *enter* hook. Moving from */home -> ~/* would not trigger the exit hook. \n\nGenerally the commands specified in the hooks will be the names of shell scripts not single shell commands.\n\nThe first section of the configuration currently has two available settings:\n\n* **default_type**: either **path** or **tree**. If setting is not specified, **path** will be used.\n* **external_hooks**: a list of paths to other YAML files containing additional hooks. Such files should resemble the **'hooks'** section of the above example configuration.\n\n### Usage\n\nAfter installing capn you will need to source:\n\n $ source capn\n\nIf you no longer wish to have the hooks activated:\n\n $ unhook\n\n### API\n\n add_external_hook(filename, path, hooktype=DEFAULT_TYPE, \n enter=[], exit=[]):\n\n\nCurrently capn has a minimal API with a single function that is used to manage programmatically generated external hook files. See the example below:\n\n >>>from capn.config import add_external_hook\n >>>filename = \"~/.otherhooks\"\n >>>path = ~/projects/foo/bar\n >>>hooktype = 'tree'\n >>>enter = ['source ~/projects/foo/bar/bin/activate']\n >>>exit = ['deactivate']\n >>>add_external_hook(filename, path, hooktype=hooktype,\n ... enter=enter, exit=exit)\n >>>\n\nThe above will add a hook to auto de/activate the python-virtualenv whenever the shell is inside the project directory to the file *\"~/.otherhooks\"*. You will then need to add the filename to the **external_hooks** list in the *\"~/.capnhooks\"* configuration file.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dustinlacewell/capn", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "capn", "package_url": "https://pypi.org/project/capn/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/capn/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/dustinlacewell/capn" }, "release_url": "https://pypi.org/project/capn/1.0rc1/", "requires_dist": null, "requires_python": null, "summary": "capn provides hooks on working-directory change.", "version": "1.0rc1" }, "last_serial": 787237, "releases": { "1.0rc1": [ { "comment_text": "", "digests": { "md5": "7cb213e28c8edb7a95f0d4f103c5eb4e", "sha256": "cdd14995a851d49f9b0975adb6c3136091a0566bf69e110afd8e9412a959d691" }, "downloads": -1, "filename": "capn-1.0rc1.tar.gz", "has_sig": false, "md5_digest": "7cb213e28c8edb7a95f0d4f103c5eb4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4337, "upload_time": "2011-04-13T18:42:07", "url": "https://files.pythonhosted.org/packages/a4/4d/bf7b99f0b34ba691ac170538c42ce9a77aa218cd13fdc73db7072eea37a4/capn-1.0rc1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7cb213e28c8edb7a95f0d4f103c5eb4e", "sha256": "cdd14995a851d49f9b0975adb6c3136091a0566bf69e110afd8e9412a959d691" }, "downloads": -1, "filename": "capn-1.0rc1.tar.gz", "has_sig": false, "md5_digest": "7cb213e28c8edb7a95f0d4f103c5eb4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4337, "upload_time": "2011-04-13T18:42:07", "url": "https://files.pythonhosted.org/packages/a4/4d/bf7b99f0b34ba691ac170538c42ce9a77aa218cd13fdc73db7072eea37a4/capn-1.0rc1.tar.gz" } ] }