{ "info": { "author": "Stephen.Y", "author_email": "stephen.jin.yee@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "pylibcli\n========\nA few libraries intend to help writing cli program more convenient.\n\nInstallation\n------------\nVia pip::\n\n $ pip install libcli\n\n\nUsage\n-----\n\nBasic\n~~~~~\nHello world: examples/hello_world.py::\n\n from libcli import default, run\n\n @default\n def main():\n print(\"Hello world!\")\n\n if __name__ == '__main__':\n run()\n\n\nDefine default and command\n~~~~~~~~~~~~~~~~~~~~~~~~~~\nlibcli.command or libcli.command(\\*\\*kwargs) could be used as a decorator to\ndefine a command function.\n\nKeyword arguments not starting with '_' passed to libcli.command would be used\nas a hint to the option of the decorated function with the same name.\n\nKeyword _name can be used to override the command name,\notherwie the function name would be used.\n\nlibcli.default or libcli.default(\\*\\*kwargs) is quite similar to command.\n\ndefault function could only be defined once.\n\nIf defined, default function is always call at the very beginning.\n\n\nDefine error\n~~~~~~~~~~~~\nlibcli.command or libcli.command(\\*\\*kwargs) could be used to decorate an exception.\n\nlibcli.command(\\*\\*kwargs) could be used to define an errno other than default 127.\n\nlibcli.run would catch all defined errors, and exit with errno as exit code.\n\n\n\nDefine option type\n~~~~~~~~~~~~~~~~~~\nby docstring: examples/simple_options.py::\n\n @default\n def main(*args, aflag=None, bflag=None, cvalue=None):\n \"\"\"Parse the args.\n\n :param aflag: Set aflag\n :type aflag: flag.\n :param bflag: Set bflag\n :type bflag: flag.\n :param int cvalue: Set cvalue\n \"\"\"\n\nby decorator hint: examples/simple_options_hinted.py::\n\n @default(aflag='_a', bflag='_b', cvalue='c:int,float')\n def main(*args, aflag=None, bflag=None, cvalue):\n\notherwise guess from option default value.\n\n\nHint string: [_]shortopt[:[[[type1],type2],type3...] | ::[[[type1],type2],type3...]=default]\n\n- startswith a '_' the option would be used as short option only, otherwise the option name would be used as a long option\n- shortopt should be a list of characters to be used as short option\n- without colons means this option requires no argument, if set function would be called with this option set a value not None.\n- a single colon means this option requires an argument\n- double colon measn the argument is optional, a default value is required\n- type list has priority\n\nPossible types (not case sensitive):\n\n- **str** a command argument could always be parsed as a string\n- **int**, **hex**, **dec**, **oct**, **bin** parse argument as an integer, int accepts 0x, 0o, 0b, 0(c-style octal literal), default decimal\n- **float** parse as a floating point number\n- **flag**, **none** accept no argument, if set value will be not None, currently ''\n\nfollowing types may vary in future:\n\n- bool '0', 'n', 'no', 'f', 'false', 'nil', 'nul', 'null', 'none', '-' is False, otherwise True\n- list a comma separated list, currently all values are supposed to be string\n- dict a comma separated key=value pair list, key and value are supposed to be string\n\n\nChained commands\n~~~~~~~~~~~~~~~~\nIf a command function returns a not None object,\nit would be used as the first argument of the next command function call.\n\nThus with a factory method as default,\nmember functions returning self as command would do the trick.\n\nexamples/crud_class.py\n\nexamples/simple_arithmetic.py\n\n\nSubmodules\n----------\n\nopttools\n~~~~~~~~\nSpecify command with decorators.\nAutomatically generate option list from decorator hinting, docstring and option default value.\nParse a list of argumens and call corresponding method in a chainable style.\n\n\n\ngetopt\n~~~~~~\nYet another implementation to work close to GNU getopt.\nUnlike standard library, pylibcli.getopt employs an iterator interface.\nOptional argument supported.\nopttools use getopt internally.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stepheny/pylibcli", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "libcli", "package_url": "https://pypi.org/project/libcli/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/libcli/", "project_urls": { "Homepage": "https://github.com/stepheny/pylibcli" }, "release_url": "https://pypi.org/project/libcli/0.3.3/", "requires_dist": null, "requires_python": "", "summary": "Library helps to build command line interface", "version": "0.3.3" }, "last_serial": 2017986, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "ec0f31c7a8005bcfb99b314b207c315c", "sha256": "548bb16e350d28d2d98b916a7ee47d971d4bec55f7151f599780989513fb3d4c" }, "downloads": -1, "filename": "libcli-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ec0f31c7a8005bcfb99b314b207c315c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11758, "upload_time": "2016-03-08T12:09:46", "url": "https://files.pythonhosted.org/packages/97/90/2becf4b7ad59615caef20b46214686a8e99e28ac5a78c7e4f0f01bc676b2/libcli-0.3.1-py3-none-any.whl" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "e6e328b0e6a441549c252ffc7cd90f2d", "sha256": "4dd95d4db4b391860d78434a76b8ea6b85d67dfa51315f7383d524cac65a2057" }, "downloads": -1, "filename": "libcli-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e6e328b0e6a441549c252ffc7cd90f2d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11757, "upload_time": "2016-03-09T09:16:34", "url": "https://files.pythonhosted.org/packages/d8/a0/fa2946ddaf3d6b60f341b03d51f7c21ec9037943d14a308d87ae867eb5d0/libcli-0.3.2-py3-none-any.whl" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "f1c14e9ecaf684a6813b02a66b9a2824", "sha256": "6951daa85efb14ce6eccdc3bb1de11d93a3e8a75c884a95dae0a63b6b0b76ed9" }, "downloads": -1, "filename": "libcli-0.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f1c14e9ecaf684a6813b02a66b9a2824", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11845, "upload_time": "2016-03-21T05:41:35", "url": "https://files.pythonhosted.org/packages/48/d0/79ebbeca3f65c777cc00a35dd7570ef30f5bb876bf70d71910d62d631ba9/libcli-0.3.3-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1c14e9ecaf684a6813b02a66b9a2824", "sha256": "6951daa85efb14ce6eccdc3bb1de11d93a3e8a75c884a95dae0a63b6b0b76ed9" }, "downloads": -1, "filename": "libcli-0.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f1c14e9ecaf684a6813b02a66b9a2824", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11845, "upload_time": "2016-03-21T05:41:35", "url": "https://files.pythonhosted.org/packages/48/d0/79ebbeca3f65c777cc00a35dd7570ef30f5bb876bf70d71910d62d631ba9/libcli-0.3.3-py3-none-any.whl" } ] }