{"id":26451830,"url":"https://github.com/SlimIO/stdin","last_synced_at":"2025-03-18T17:01:53.871Z","repository":{"id":42570359,"uuid":"207160921","full_name":"TopCli/stdin","owner":"TopCli","description":"Node.js light ⚡, interactive and elegant input crafted for REPL experience.","archived":false,"fork":false,"pushed_at":"2024-02-01T01:11:42.000Z","size":211,"stargazers_count":10,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T08:52:05.963Z","etag":null,"topics":["cli","input","interactive","repl","stdin","tty"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/TopCli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-08T19:13:46.000Z","updated_at":"2024-04-10T01:12:35.000Z","dependencies_parsed_at":"2023-02-10T10:45:49.797Z","dependency_job_id":"63d161f8-6958-4466-8602-d23421ff17d4","html_url":"https://github.com/TopCli/stdin","commit_stats":null,"previous_names":["slimio/stdin"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Fstdin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Fstdin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Fstdin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TopCli%2Fstdin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TopCli","download_url":"https://codeload.github.com/TopCli/stdin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244267376,"owners_count":20425835,"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","input","interactive","repl","stdin","tty"],"created_at":"2025-03-18T17:01:05.639Z","updated_at":"2025-03-18T17:01:53.865Z","avatar_url":"https://github.com/TopCli.png","language":"JavaScript","readme":"# Stdin\n![version](https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge\u0026url=https://raw.githubusercontent.com/TopCli/stdin/master/package.json\u0026query=$.version\u0026label=Version)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://github.com/TopCli/stdin/commit-activity)\n[![mit](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://github.com/TopCli/stdin/blob/master/LICENSE)\n[![OpenSSF\nScorecard](https://api.securityscorecards.dev/projects/github.com/TopCli/stdin/badge?style=for-the-badge)](https://api.securityscorecards.dev/projects/github.com/TopCli/stdin)\n![build](https://img.shields.io/github/actions/workflow/status/TopCli/stdin/node.js.yml?style=for-the-badge)\n\nNode.js light and interactive standard input (stdin) crafted for REPL (like) experience (with auto-completion and history). Under the hood it use `process.stdin` and TTY Stream with the raw mode enabled to catch key by key.\n\n\u003cp align=\"center\"\u003eDemo with the SlimIO CLI\u003cp\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://i.imgur.com/t18LDhm.gif\"\u003e\n\u003c/p\u003e\n\n## Requirements\n- [Node.js](https://nodejs.org/en/) v14 or higher\n\n## Getting Started\n\nThis package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).\n\n```bash\n$ npm i @topcli/stdin\n# or\n$ yarn add @topcli/stdin\n```\n\n## Usage example\n```js\nimport stdin from \"@topcli/stdin\";\n\nconst data = await stdin(\"Question title \u003e \", {\n  history: [\"command in history 1\", \"command in history 2\"],\n  autocomplete: [\n    \"events\",\n    \"events.get_info\"\n  ]\n});\nconsole.log(`input data: ${data}`);\n```\n\n\u003e 👀 the reference to the history array is keeped. So if you want to achieve a while of input, think to declare a top array history that will be used by all inputs.\n\n## API\n\n### stdin(query: null | string, options?: StdinOptions): Promise\u003c string \u003e\nQuery paramaters can be set to `null` to disable the title. Options is described by the following TypeScript interface:\n\n```ts\ninterface StdinOptions {\n    history?: string[];\n    autocomplete?: string[];\n}\n```\n\nhistory and autocomplete are optional. There is no thing as a cache or limitation for history (you have to implement that kind of stuff yourself with [cacache](https://www.npmjs.com/package/cacache)).\n\n## Contributors ✨\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://www.linkedin.com/in/thomas-gentilhomme/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4438263?v=4?s=100\" width=\"100px;\" alt=\"Gentilhomme\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGentilhomme\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/stdin/commits?author=fraxken\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/stdin/commits?author=fraxken\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/stdin/pulls?q=is%3Apr+reviewed-by%3Afraxken\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"#security-fraxken\" title=\"Security\"\u003e🛡️\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/stdin/issues?q=author%3Afraxken\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/AlexandreMalaj\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/32218832?v=4?s=100\" width=\"100px;\" alt=\"Alexandre Malaj\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlexandre Malaj\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/stdin/commits?author=AlexandreMalaj\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/stdin/commits?author=AlexandreMalaj\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/PierreDemailly\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/39910767?v=4?s=100\" width=\"100px;\" alt=\"PierreDemailly\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePierreDemailly\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/TopCli/stdin/commits?author=PierreDemailly\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/TopCli/stdin/commits?author=PierreDemailly\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## License\nMIT\n","funding_links":[],"categories":["Packages"],"sub_categories":["CLI (TTY etc..)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSlimIO%2Fstdin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSlimIO%2Fstdin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSlimIO%2Fstdin/lists"}