{ "info": { "author": "Christopher D. Lasher", "author_email": "chris.lasher@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries" ], "description": "=====================\nConflictsOptionParser\n=====================\n\nConflictsOptionParser provides a command line interface, based off the Python\nStandard Library's own `optparse.OptionParser\n`_. (Users of this library\nshould have familiarity with the ``optparse`` library.)\n``conflictsparse.ConflictsOptionParser`` acts as a drop-in replacement for\n``optparse.OptionParser`` that has a few additional methods for specifying\noptions which conflict with each other, and has additional behavior for\nautomatically raising an error when detecting conflicting options parsed from\nthe command line arguments.\n\nThese two additional methods in ``conflictsparse.ConflictsOptionParser`` are\n\n``register_conflict(options, message=None)``\n where ``options`` is an iterable of options, either ``optparse.Option``\n instances, or their corresponding option strings; marks any combination of\n these options as conflicting, and will cause the parser to report the\n conflicting options through an error, using either the specified ``message``\n or constructing one as needed, and to exit immediately.\n\n``unregister_conflict(options)``\n like ``register_conflict`` but removes the combination of options from\n registered conflicts.\n\n\nExample Usage\n=============\n\n::\n\n #/usr/bin/env python\n # File: tryconflictsparse.py\n import conflictsparse\n parser = conflictsparse.ConflictsOptionParser(\"python %prog [OPTIONS] ARG\")\n # You can retain the Option instances for flexibility, in case you change\n # option strings later\n verbose_opt = parser.add_option('-v', '--verbose', action='store_true')\n quiet_opt = parser.add_option('-q', '--quiet', action='store_true')\n # Alternatively, you don't need to keep references to the instances;\n # we can re-use the option strings later\n parser.add_option('--no-output', action='store_true')\n # Register the conflict. Specifying an error message is optional; the\n # generic one that is generated will usually do.\n parser.register_conflict((verbose_opt, quiet_opt, '--no-output'))\n # Now we parse the arguments as we would with\n # optparse.OptionParser.parse_args()\n opts, args = parser.parse_args()\n print \"Opts are\", opts\n print \"Args are\", args\n\nThen if we ran\n\n::\n\n python tryconflictsparse.py -v 42\n\n\nwe would get\n\n::\n\n Opts are {'verbose': True, 'no_output': None, 'quiet': None}\n Args are ['42']\n\n\nBut suppose we give conflicting options on the command line.\n\n::\n\n python tryconflictsparse.py -v --no-output 42\n\nThen the parser would automatically raise an error and exit.\n\n::\n\n Usage: python tryconflictsparse.py [OPTIONS] ARG\n\n tryconflictsparse.py: error: --verbose, --quiet, --no-output are incompatible options.\n\n\nInstallation\n============\n\nConflictsOptionParser is available from the Python Package Index at\nhttp://pypi.python.org/pypi/ConflictsOptionParser\n\nYou can install using `pip `_.\n\n::\n\n pip install ConflictsOptionParser\n\n\nDevelopment\n===========\n\nSource code is hosted on BitBucket at\nhttps://bitbucket.org/gotgenes/conflictsoptionparser/\n\n\nBug Reports\n===========\n\nPlease report any bugs on the BitBucket Issue Tracker at\nhttps://bitbucket.org/gotgenes/conflictsoptionparser/issues\n\n\nAcknowledgements\n================\n\nThis work was originally inspired by `a solution on Stack Overflow by T\u00e1mas `_.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/ConvUtils/", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "ConflictsOptionParser", "package_url": "https://pypi.org/project/ConflictsOptionParser/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ConflictsOptionParser/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/ConvUtils/" }, "release_url": "https://pypi.org/project/ConflictsOptionParser/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "A command line interface that recognizes conflicting options given as arguments.", "version": "0.1.1" }, "last_serial": 784009, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e7cfad74bbae06318faaba2c51da99f5", "sha256": "8a1814e0e7b5511a50893a9a67c782b604d95ba4b89700cec57b935683a4e947" }, "downloads": -1, "filename": "ConflictsOptionParser-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e7cfad74bbae06318faaba2c51da99f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5752, "upload_time": "2011-01-20T16:57:32", "url": "https://files.pythonhosted.org/packages/f7/57/df76330a0bb04a401e4c1f87b5d79b9c39416524d06c07162085b0b8479c/ConflictsOptionParser-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "48bb59ed0d0bdfe4c095ee64b1a0f9ba", "sha256": "05c72d18a89ce3dba6f8517a7ea8222436c1b4d9290a9af35fff1d96e838d187" }, "downloads": -1, "filename": "ConflictsOptionParser-0.1.1.tar.gz", "has_sig": false, "md5_digest": "48bb59ed0d0bdfe4c095ee64b1a0f9ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5841, "upload_time": "2011-01-23T05:22:30", "url": "https://files.pythonhosted.org/packages/1f/03/6eb1bbdcc979e59ecfdbad80d3c9c7438daf2c9e2edb23f7b87679776e89/ConflictsOptionParser-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "48bb59ed0d0bdfe4c095ee64b1a0f9ba", "sha256": "05c72d18a89ce3dba6f8517a7ea8222436c1b4d9290a9af35fff1d96e838d187" }, "downloads": -1, "filename": "ConflictsOptionParser-0.1.1.tar.gz", "has_sig": false, "md5_digest": "48bb59ed0d0bdfe4c095ee64b1a0f9ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5841, "upload_time": "2011-01-23T05:22:30", "url": "https://files.pythonhosted.org/packages/1f/03/6eb1bbdcc979e59ecfdbad80d3c9c7438daf2c9e2edb23f7b87679776e89/ConflictsOptionParser-0.1.1.tar.gz" } ] }