{"id":42667859,"url":"https://github.com/oboard/readline","last_synced_at":"2026-01-29T10:13:12.167Z","repository":{"id":307060237,"uuid":"1028182645","full_name":"oboard/readline","owner":"oboard","description":"A readline library for MoonBit","archived":false,"fork":false,"pushed_at":"2025-08-23T05:45:33.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T08:51:57.792Z","etag":null,"topics":["moonbit"],"latest_commit_sha":null,"homepage":"https://mooncakes.io/docs/oboard/readline","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oboard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2025-07-29T06:39:58.000Z","updated_at":"2025-08-23T05:45:36.000Z","dependencies_parsed_at":"2025-08-04T08:30:17.275Z","dependency_job_id":null,"html_url":"https://github.com/oboard/readline","commit_stats":null,"previous_names":["oboard/readline"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oboard/readline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Freadline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Freadline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Freadline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Freadline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oboard","download_url":"https://codeload.github.com/oboard/readline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Freadline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28875450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T09:47:23.353Z","status":"ssl_error","status_checked_at":"2026-01-29T09:47:19.357Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["moonbit"],"created_at":"2026-01-29T10:13:11.139Z","updated_at":"2026-01-29T10:13:12.158Z","avatar_url":"https://github.com/oboard.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oboard/readline\n\nA readline library for MoonBit\n\n## Features\n\n- 🔄 **Callback-based**: Asynchronous input handling with callback functions\n- 🧹 **Resource management**: Proper cleanup with `close()` method\n- 📝 **Simple API**: Easy-to-use interface for interactive console applications\n- 🚀 **Zero dependencies**: Lightweight implementation using only standard libraries\n- 🌐 **Cross-platform**: Works on JavaScript, Native (C) targets\n\n## Installation\n\nAdd this package to your MoonBit project:\n\n```bash\nmoon add oboard/readline\n```\n\n## Quick Start\n\n```moonbit\nfn main {\n  let rl = @readline.new()\n  rl.question(\"What is your name? \", name =\u003e {\n    println(\"Hello \" + name)\n    rl.question(\"How old are you? \", age =\u003e {\n      println(\"You are \" + age + \" years old\")\n      rl.close()\n    })\n  })\n}\n```\n\n## API Reference\n\n### `new() -\u003e T`\n\nCreates a new readline instance.\n\n```moonbit\nlet rl = @readline.new()\n```\n\n### `T::question(self: T, question: String, callback: (String) -\u003e Unit) -\u003e Unit`\n\nPrompts the user with a question and calls the callback function with the user's input.\n\n**Parameters:**\n- `question`: The prompt text to display\n- `callback`: Function to handle the user's input\n\n```moonbit\nrl.question(\"Enter your name: \", input =\u003e {\n  println(\"You entered: \" + input)\n})\n```\n\n### `T::close(self: T) -\u003e Unit`\n\nCleans up the readline instance and releases resources.\n\n```moonbit\nrl.close()\n```\n\n## Platform Support\n\n| Platform | Implementation | Status |\n|----------|----------------|--------|\n| JavaScript | Browser/Node.js | ✅ Supported |\n| Native | C with stdio | ✅ Supported |\n| WebAssembly | WASM | ❌ Unsupported |\n\n## Examples\n\n### Simple Q\u0026A\n\n```moonbit\nfn main {\n  let rl = @readline.new()\n  rl.question(\"What's your favorite color? \", color =\u003e {\n    println(\"Nice choice: \" + color)\n    rl.close()\n  })\n}\n```\n\n### Multiple Questions\n\n```moonbit\nfn main {\n  let rl = @readline.new()\n  rl.question(\"First name: \", first =\u003e {\n    rl.question(\"Last name: \", last =\u003e {\n      println(\"Full name: \" + first + \" \" + last)\n      rl.close()\n    })\n  })\n}\n```\n\n## Building and Testing\n\n## Implementation Details\n\n- **JavaScript**: Uses `prompt()` for browser environments and `stdin/stdout` for Node.js\n- **Native**: Uses standard C `scanf()` and `printf()` functions\n\n## License\n\nApache-2.0\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n\n## Changelog\n\n### v0.1.0\n- Initial release\n- Cross-platform readline support\n- Basic question/answer functionality\n- Resource cleanup with close() method","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foboard%2Freadline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foboard%2Freadline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foboard%2Freadline/lists"}