{ "info": { "author": "Veit Heller", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# lens\n\n`lens` is a command line tool for easy traversal and\npretty printing fo data structures from the terminal.\nIt is extensible.\n\nUses the great [Pygments](http://pygments.org/) library.\n\nIt should work on both Python 2 and 3, but was developed\nwith Python 3 in mind.\n\n## Installation\n\nThe package is yet registered to PyPI. That means you should\nbe able to install it with pip. `lens` was already taken, so\nwe used `lens-cli`.\n\n```\npip install lens-cli\n```\n\n## Usage\n\nCalling `lens -h` will print this message:\n\n```\nusage: lens [-h] [--input INPUT] [--format FORMAT]\n [--no-highlight NO_HIGHLIGHT]\n [key [key ...]]\n\nExtensible data structure traversal from the command line\n\npositional arguments:\n key the keys to traverse\n\noptional arguments:\n -h, --help show this help message and exit\n --input INPUT, -i INPUT\n the input file (defaults to the standard input)\n --format FORMAT, -f FORMAT\n the data format to consume (defaults to json)\n --no-highlight NO_HIGHLIGHT, -n NO_HIGHLIGHT\n prevent syntax highlighting\n```\n\nThis should be relatively straightforward. Let's go through a few examples:\n\n```bash\n# just calling lens will print everything, syntax-highlighted\n$ curl -s https://httpbin.org/get | lens\n{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\", \n \"Accept-Encoding\": \"gzip, deflate, br\", \n \"Accept-Language\": \"de,en-US;q=0.7,en;q=0.3\", \n \"Dnt\": \"1\", \n \"Host\": \"httpbin.org\", \n \"Referer\": \"https://httpbin.org/\", \n \"Upgrade-Insecure-Requests\": \"1\", \n \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0\"\n }, \n \"origin\": \"213.61.134.12\", \n \"url\": \"https://httpbin.org/get\"\n}\n\n# suppose we only want to see the \"Host\" header\n$ curl -s https://httpbin.org/get | lens header Host\n\"httpbin.org\"\n\n# or use xml\n$ curl -s https://httpbin.org/xml | lens -f=xml\n\n \n Wake up to WonderWidgets!\n \n \n Overview\n Why WonderWidgets are great\n \n Who buys WonderWidgets\n \n\n\n# suppose we want to only get the title of the second slide\n$ curl -s https://httpbin.org/xml | lens -f=xml slide 1 title\nOverview\n```\n\nWe can also read from files by providing an `-i` option.\nlens also discovers if its output is redirected to a file, in which case\nno syntax highlighting will be applied (the same can be achieved through\nthe `--no-highlighting/-n` option).\n\n## Extending\n\nYou can write your own parsers/traversers - admittedly, parsers\nis not a great name, but for now we stick with it.\n\nThey should inherit from `LensParser` in `lens.parsers.base`,\nand at least implement the method `treat(self, inpt, keys)`,\nwhere `inpt` is the input string and `keys` are the keys to\ntraverse. It should return the traversed data structure as a\nstring.\n\nOptionally, the parser can specify a Pygments lexer by exposing\nthe static attribute `lexer`, if highlighting is applicable. It\nwill work without one, though.\n\nThe plugins can be third party `pip` modules, in which case they\nshould follow the naming scheme `lens-{format-name}` and export\nthe parser under the name `Parser`.\n\nAn example of a plugin can be found in the\n[bson](https://github.com/port-zero/lens_bson) parser repository.\n\nThat is all you need to know!\n\n
\n\nHave fun!", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/port-zero/lens/tarball/0.1.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/port-zero/lens", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lens-cli", "package_url": "https://pypi.org/project/lens-cli/", "platform": "", "project_url": "https://pypi.org/project/lens-cli/", "project_urls": { "Download": "https://github.com/port-zero/lens/tarball/0.1.4", "Homepage": "https://github.com/port-zero/lens" }, "release_url": "https://pypi.org/project/lens-cli/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "Extensible data structure traversal in the command line", "version": "0.1.4" }, "last_serial": 5667451, "releases": { "0.0.5": [ { "comment_text": "", "digests": { "md5": "0af6621c7a6155a9a001a88a55214b5c", "sha256": "a94417fe638f7fb55004205feb0e8044d3c6051b2c463f1add7acae151fe65ae" }, "downloads": -1, "filename": "lens-cli-0.0.5.tar.gz", "has_sig": false, "md5_digest": "0af6621c7a6155a9a001a88a55214b5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2734, "upload_time": "2016-11-28T18:28:43", "url": "https://files.pythonhosted.org/packages/1a/0b/8348cbba6882036e2888e96e8a775efd70b372168f9c71a6bf4795b0060e/lens-cli-0.0.5.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "81db9b1143985901d05bf1681e48df00", "sha256": "267ac7d23f78f652b4819cbcd0446a56ddf5e96b35e2250af35c4fc0155f1c59" }, "downloads": -1, "filename": "lens-cli-0.1.0.tar.gz", "has_sig": false, "md5_digest": "81db9b1143985901d05bf1681e48df00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2827, "upload_time": "2016-11-29T22:27:10", "url": "https://files.pythonhosted.org/packages/df/73/0d9d6d848d1e988f07d7f33d70ca98fd1cca08600590c53654cf48aa77ca/lens-cli-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ea8b97a9287ee9c42c078b7dfdbb6bc5", "sha256": "1c29f724df6edc6375318bb3292b9a1ad21bcbe3491111e20a34d2f4ae6b8de0" }, "downloads": -1, "filename": "lens-cli-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ea8b97a9287ee9c42c078b7dfdbb6bc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848, "upload_time": "2016-11-29T22:43:07", "url": "https://files.pythonhosted.org/packages/17/6e/93901509f118ed66a44479d07909fa957c1fa49687840d8667ea4656be62/lens-cli-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "bbf74ad794f7de1eee17181766ce6382", "sha256": "0b5004e42631105ad56b8e4868ef43e82f49836eb2c3aff4342b18dfdabae2af" }, "downloads": -1, "filename": "lens-cli-0.1.2.tar.gz", "has_sig": false, "md5_digest": "bbf74ad794f7de1eee17181766ce6382", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2965, "upload_time": "2016-11-30T12:36:13", "url": "https://files.pythonhosted.org/packages/ca/1f/0365206708dc6729cd98e9848e749999157cc64fff7d501205fc715b49c4/lens-cli-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "d7d7e183b472bff4e051e08309d91858", "sha256": "c6899752000ace10d305ffda48d0e5337face9ac9c35483a69fb74e88f23795e" }, "downloads": -1, "filename": "lens_cli-0.1.3-py3.7.egg", "has_sig": false, "md5_digest": "d7d7e183b472bff4e051e08309d91858", "packagetype": "bdist_egg", "python_version": "3.7", "requires_python": null, "size": 13662, "upload_time": "2019-08-12T16:26:14", "url": "https://files.pythonhosted.org/packages/99/3f/d5a945fb9e98ae6f80645c38738895fdd5eebef1a90dba83222622bd2bb1/lens_cli-0.1.3-py3.7.egg" }, { "comment_text": "", "digests": { "md5": "73554a34ededbc74feee647ac4298a0c", "sha256": "3a7b2a26c65c322c34aac3adb89500a39544989d52fa077a2c8f6397f76c9bbb" }, "downloads": -1, "filename": "lens-cli-0.1.3.tar.gz", "has_sig": false, "md5_digest": "73554a34ededbc74feee647ac4298a0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5011, "upload_time": "2019-08-12T16:13:50", "url": "https://files.pythonhosted.org/packages/7f/91/866f25fd83fea3d4dfeb3e8aaf0c60bbaca64b089ae170efa38ab839cea1/lens-cli-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "67fdc11aba9ca83f9ca1b45511301ab5", "sha256": "8a755ceb5a07044b4dabbd1cb18bbc17a207338f25d7b46b9082a827eca3392a" }, "downloads": -1, "filename": "lens-cli-0.1.4.tar.gz", "has_sig": false, "md5_digest": "67fdc11aba9ca83f9ca1b45511301ab5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5031, "upload_time": "2019-08-12T16:26:13", "url": "https://files.pythonhosted.org/packages/fd/59/cc0fb74e66366f31b0543764da59a07d048866585b42ea02f77f728918b7/lens-cli-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "67fdc11aba9ca83f9ca1b45511301ab5", "sha256": "8a755ceb5a07044b4dabbd1cb18bbc17a207338f25d7b46b9082a827eca3392a" }, "downloads": -1, "filename": "lens-cli-0.1.4.tar.gz", "has_sig": false, "md5_digest": "67fdc11aba9ca83f9ca1b45511301ab5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5031, "upload_time": "2019-08-12T16:26:13", "url": "https://files.pythonhosted.org/packages/fd/59/cc0fb74e66366f31b0543764da59a07d048866585b42ea02f77f728918b7/lens-cli-0.1.4.tar.gz" } ] }