{"id":39632402,"url":"https://github.com/port-zero/lens","last_synced_at":"2026-01-18T08:47:24.618Z","repository":{"id":62575634,"uuid":"74773059","full_name":"port-zero/lens","owner":"port-zero","description":"Data structure traversal in the command line","archived":false,"fork":false,"pushed_at":"2019-08-12T16:25:41.000Z","size":16,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-08T19:55:48.067Z","etag":null,"topics":["data-analysis","lens","traversal"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/port-zero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-25T16:22:42.000Z","updated_at":"2023-10-02T12:27:40.000Z","dependencies_parsed_at":"2022-11-03T18:58:57.849Z","dependency_job_id":null,"html_url":"https://github.com/port-zero/lens","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/port-zero/lens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/port-zero%2Flens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/port-zero%2Flens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/port-zero%2Flens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/port-zero%2Flens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/port-zero","download_url":"https://codeload.github.com/port-zero/lens/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/port-zero%2Flens/sbom","scorecard":{"id":741390,"data":{"date":"2025-08-11","repo":{"name":"github.com/port-zero/lens","commit":"06b52dd8ac3dde2f7f162a567f8e5e961e7209b1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T17:33:41.517Z","repository_id":62575634,"created_at":"2025-08-22T17:33:41.518Z","updated_at":"2025-08-22T17:33:41.518Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","lens","traversal"],"created_at":"2026-01-18T08:47:24.246Z","updated_at":"2026-01-18T08:47:24.606Z","avatar_url":"https://github.com/port-zero.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 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\u003cslideshow \n    title=\"Sample Slide Show\"\n    date=\"Date of publication\"\n    author=\"Yours Truly\"\n    \u003e\n    \u003cslide type=\"all\"\u003e\n      \u003ctitle\u003eWake up to WonderWidgets!\u003c/title\u003e\n    \u003c/slide\u003e\n    \u003cslide type=\"all\"\u003e\n        \u003ctitle\u003eOverview\u003c/title\u003e\n        \u003citem\u003eWhy \u003cem\u003eWonderWidgets\u003c/em\u003e are great\u003c/item\u003e\n        \u003citem/\u003e\n        \u003citem\u003eWho \u003cem\u003ebuys\u003c/em\u003e WonderWidgets\u003c/item\u003e\n    \u003c/slide\u003e\n\u003c/slideshow\u003e\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\n\u003ctitle\u003eOverview\u003c/title\u003e\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\u003chr/\u003e\n\nHave fun!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fport-zero%2Flens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fport-zero%2Flens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fport-zero%2Flens/lists"}