{"id":24567335,"url":"https://github.com/marvinwu/piper-cli","last_synced_at":"2025-07-17T18:33:07.689Z","repository":{"id":48200534,"uuid":"375186982","full_name":"marvinwu/piper-cli","owner":"marvinwu","description":"a simple cli wrapper to process ndjson using well known packages such as lodash,voca and others","archived":false,"fork":false,"pushed_at":"2021-08-07T10:38:09.000Z","size":519,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T19:17:28.445Z","etag":null,"topics":["cli","lodash","ndjson","voca"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marvinwu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-09T01:09:15.000Z","updated_at":"2023-12-05T06:52:50.000Z","dependencies_parsed_at":"2022-08-30T05:32:24.298Z","dependency_job_id":null,"html_url":"https://github.com/marvinwu/piper-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marvinwu/piper-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvinwu%2Fpiper-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvinwu%2Fpiper-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvinwu%2Fpiper-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvinwu%2Fpiper-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marvinwu","download_url":"https://codeload.github.com/marvinwu/piper-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvinwu%2Fpiper-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265645449,"owners_count":23804188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli","lodash","ndjson","voca"],"created_at":"2025-01-23T13:17:48.857Z","updated_at":"2025-07-17T18:33:07.671Z","avatar_url":"https://github.com/marvinwu.png","language":"JavaScript","readme":"## purpose\n\na simple cli wrapper to process ndjson using well known packages such as\nlodash,voca and others\n## example\n\n### Lodash\n\n- using lodash keyBy function to process an nested array\n\n[Lodash](https://lodash.com/)\n\n```bash\necho \"{\\\"title\\\":\\\"hello:world \\\",\\\"testArray\\\":[\\\"1\\\",\\\"2\\\"],\\\"testNested\\\":[{\\\"title\\\":\\\"hello\\\",\\\"content\\\":\\\"hellooooooo\\\"},{\\\"title\\\":\\\"world\\\",\\\"content\\\":\\\"random test\\\"}]}\" | ./bin/cli  _.keyBy title -p testNested -a keyed_testNested | jq\n{\n  \"title\": \"hello:world \",\n  \"testArray\": [\n    \"1\",\n    \"2\"\n  ],\n  \"testNested\": [\n    {\n      \"title\": \"hello\",\n      \"content\": \"hellooooooo\"\n    },\n    {\n      \"title\": \"world\",\n      \"content\": \"random test\"\n    }\n  ],\n  \"keyed_testNested\": {\n    \"hello\": {\n      \"title\": \"hello\",\n      \"content\": \"hellooooooo\"\n    },\n    \"world\": {\n      \"title\": \"world\",\n      \"content\": \"random test\"\n    }\n  }\n}\n```\n\n- use lodash split by function\n\n```bash\necho \"{\\\"title\\\":\\\"hello:world \\\"}\" | ./bin/cli  _.split : -p title\n```\n\n- use lodash join by function, join array by newline\n\n```bash\necho \"{\\\"test\\\":[\\\"hello\\\",\\\"world\\\"]}\" | ./bin/cli  _.join $'\\n' -p test -a test2\n{\"test\":[\"hello\",\"world\"],\"test2\":\"hello\\nworld\"}\n```\n\n- flatten\n\n[flat - npm](https://www.npmjs.com/package/flat)\n\n==can pass json paramter to flat function==\n\n```\ncat test/input/test3.json\n {\"some\":\"thing\"}\n {\"foo\":17,\"bar\":false,\"quux\":true}\n {\"may\":{\"include\":\"nested\",\"objects\":[\"and\",\"arrays\"]}}\n\n\ncat test/input/test3.json |  ./bin/cli  flat '{\"safe\":true,\"delimiter\":\"!\"}'\n{\"some\":\"thing\"}\n{\"foo\":17,\"bar\":false,\"quux\":true}\n{\"may!include\":\"nested\",\"may!objects\":[\"and\",\"arrays\"]}\n```\n\n### html to text\n\n```\ncat test/input/html-to-text.json | bin/cli 'html-to-text' -p html -a text\n#{\"html\":\"\u003ch1\u003eHello World\u003c/h1\u003e\",\"text\":\"HELLO WORLD\"}\n```\n\n### compromise\ncat test/input/nlp1.json | bin/cli compromise.topics.json -p text -a nlp\n\n\n### wink nlp\ncat test/input/nlp1.json | bin/cli wink-nlp.entities.out -p text -a nlp\n\n\n## compose SQL\n\n```bash\n echo '{\"genus\": \"adenia\"}' | ./bin/cli compose -a 'hello' --db test/input/hello.db \"select * from hello_world where genus like '\u003c%= genus %\u003e'\" --key test\n```\n\n\n\n```\ncat test/input/html-to-text.json | bin/cli 'html-to-text' -p html -a text\ncat test/input/nlp1.json | bin/cli compromise.topics.json -p text -a nlp\ncat test/input/nlp1.json | bin/cli wink-nlp.entities.out -p text -a nlp\necho \"{\\\"test\\\":[\\\"hello\\\",\\\"world\\\"]}\" | ./bin/cli  _.join $'\\n' -p test -a test2\necho \"{\\\"title\\\":\\\"hello:world \\\"}\" | ./bin/cli  _.split : -p title\ncat test/input/array_to_object.json | jq -c '.[]' | bin/cli array-to-object -p quick_look\ncat test/input/array_to_object.json | jq -c '.[]' | bin/cli _.keyBy quick_look_title  -p quick_look \ncat test/input/array_to_object.json | jq -c '.[]' | bin/cli log -p quick_look\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarvinwu%2Fpiper-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarvinwu%2Fpiper-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarvinwu%2Fpiper-cli/lists"}