{"id":20985790,"url":"https://github.com/keegandonley/input-deno","last_synced_at":"2025-09-07T17:35:29.800Z","repository":{"id":46274302,"uuid":"267168500","full_name":"keegandonley/input-deno","owner":"keegandonley","description":"CLI user input handler for Deno","archived":false,"fork":false,"pushed_at":"2024-01-04T22:15:18.000Z","size":52,"stargazers_count":11,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-01T03:33:41.331Z","etag":null,"topics":["cli","deno","hacktoberfest","input"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/keegandonley.png","metadata":{"files":{"readme":"README.md","changelog":"history.test.ts","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-26T22:51:59.000Z","updated_at":"2024-01-05T15:59:53.000Z","dependencies_parsed_at":"2024-11-18T14:53:24.811Z","dependency_job_id":"6c091a6b-4dee-4657-9b77-b92b7bc5ad46","html_url":"https://github.com/keegandonley/input-deno","commit_stats":{"total_commits":40,"total_committers":4,"mean_commits":10.0,"dds":0.125,"last_synced_commit":"47b6e872cd078c0ad8ec2300a2ac5ba54f7f6350"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/keegandonley/input-deno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keegandonley%2Finput-deno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keegandonley%2Finput-deno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keegandonley%2Finput-deno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keegandonley%2Finput-deno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keegandonley","download_url":"https://codeload.github.com/keegandonley/input-deno/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keegandonley%2Finput-deno/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274069880,"owners_count":25217212,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"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":["cli","deno","hacktoberfest","input"],"created_at":"2024-11-19T06:10:13.341Z","updated_at":"2025-09-07T17:35:29.549Z","avatar_url":"https://github.com/keegandonley.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n![input](https://raw.githubusercontent.com/keegandonley/input-deno/master/.github/input.png)\n\n\u003c/div\u003e\n\n# Input-Deno v2.0.4\n![Tests](https://github.com/keegandonley/input-deno/workflows/Tests/badge.svg)\n\nUsed to get command line input from the user\n\n## Choose\nReturns an array indicating which index was selected\n\n```javascript\nconst input = new InputLoop();\nconst accepting = await input.choose([\"Accepting node\", \"Non-accepting node\"]);\n\n// output:\n\n// ------------------------------\n// 0: Accepting node\n// 1: Non-accepting node\n// ------------------------------\n\n// Return value:\n// [false, true]\n```\n\n## Question\nAsk a single question\n\n```javascript\nconst input = new InputLoop();\nconst nodeName = await input.question('Enter the label for the node:');\n\n// output:\n\n// Enter the label for the node:\n\n// Return Value:\n// 'a'\n```\n\nSkip the newline after printing the question:\n```javascript\nconst input = new InputLoop();\nconst nodeName = await input.question('Enter the label for the node:', false);\n\n// output:\n\n// Enter the label for the node:\n\n// Return Value:\n// 'a'\n```\n\n## Looping\nControl an input loop which continues reprompting until terminated\n\n#### Automatic Looping:\nPassing `true` as the second argument will automatically end the iteration of the last option is selected.\n\n```javascript\nconst input = new InputLoop();\nconst mainQuestions = [\"Add a node\", \"Add an edge\", \"Set starting node\", \"Evaluate a string\", \"Quit\"];\n\nwhile (!input.done) {\n\tconst result = await input.choose(mainQuestions, true);\n\n\t// Business logic...\n}\n```\n\n#### Manual Looping:\n```javascript\nconst input = new InputLoop();\nconst mainQuestions = [\"Add a node\", \"Add an edge\", \"Set starting node\", \"Evaluate a string\", \"Quit\"];\n\nwhile (!input.done) {\n\tconst result = await input.choose(mainQuestions);\n\n\t// Business logic...\n\n\tif (result[mainQuestions.length - 1]) {\n\t\tinput.close();\n\t}\n}\n```\n\n## Repeat\nRepeat the previous question\n\n```javascript\nconst input = new InputLoop();\nconst mainQuestions = [\"Add a node\", \"Add an edge\", \"Set starting node\", \"Evaluate a string\", \"Quit\"];\n\nlet result = await input.choose(mainQuestions);\n\nwhile (!(result[0] || result[1])) {\n\tresult = input.repeat();\n}\n\n```\n\n## Experimental\nIn order to use private input (not visible as you type), use the `--unstable` flag when running, and you can pass a flag to `choose` or `question` to enable it:\n```javascript\nconst input = new InputLoop();\nconst mainQuestions = [\"Add a node\", \"Add an edge\", \"Set starting node\", \"Evaluate a string\", \"Quit\"];\n\nlet result = await input.choose(mainQuestions, false, true);\n\nwhile (!(result[0] || result[1])) {\n\tresult = input.repeat();\n}\n```\n\nThis is also required for `input.wait()`, which can be used to wait for any key to be pressed:\n\n```javascript\nawait input.wait('Press any key to continue...', true);\n\n// Equivalent to\nawait input.wait();\n```\n\n## Testing\nDeno tests can be run using:\n```\nmake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeegandonley%2Finput-deno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeegandonley%2Finput-deno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeegandonley%2Finput-deno/lists"}