{"id":13804712,"url":"https://github.com/robacarp/keimeno","last_synced_at":"2025-05-12T23:20:51.163Z","repository":{"id":66257208,"uuid":"148924633","full_name":"robacarp/keimeno","owner":"robacarp","description":"A lightweight text user interface library in Crystal","archived":false,"fork":false,"pushed_at":"2020-04-04T04:12:50.000Z","size":19,"stargazers_count":14,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T04:32:48.945Z","etag":null,"topics":["crystal","demo","mud","telnet","tui"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/robacarp.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}},"created_at":"2018-09-15T17:33:56.000Z","updated_at":"2024-03-09T22:08:14.000Z","dependencies_parsed_at":"2023-02-20T21:30:56.807Z","dependency_job_id":null,"html_url":"https://github.com/robacarp/keimeno","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fkeimeno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fkeimeno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fkeimeno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fkeimeno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robacarp","download_url":"https://codeload.github.com/robacarp/keimeno/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253838015,"owners_count":21972085,"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":["crystal","demo","mud","telnet","tui"],"created_at":"2024-08-04T01:00:53.028Z","updated_at":"2025-05-12T23:20:51.141Z","avatar_url":"https://github.com/robacarp.png","language":"Crystal","funding_links":[],"categories":["CLI Builders"],"sub_categories":[],"readme":"# κείμενο - \"keímeno\" - text\n\n[![Crystal Version](https://img.shields.io/badge/crystal-0.33-blueviolet.svg?longCache=true\u0026style=for-the-badge)](https://crystal-lang.org/)\n[![GitHub](https://img.shields.io/github/license/robacarp/keimeno.svg?style=for-the-badge)](https://tldrlegal.com/license/mit-license)\n\nA lightweight and simple, native crystal library for text based interactive command line interfaces (TUI).\n\n[FZF like demo](https://i.imgur.com/DiZ2QQz.gifv)\n\n## Installation\n\nUpdate your shard.yml to include keymeno\n\n```diff\ndependencies:\n+  keimeno:\n+    github: robacarp/keimeno\n```\n\n## Usage\n\nSee [the demos](/demo).\n\nA basic command line utility can probably be built using the primitives provided herein: menu, prompt, text input. But that wouldn't be any fun if you were limited to those only.\n\nTo build your own interactive utility, subclass `Keimeno::Base`:\n\n```crystal\nclass CoolMenu \u003c Keimeno::Base\n  # The following methods provide high level anchoring into the TUI engine:\n\n  # Display methods are called each time the interface needs to be updated\n  def before_display\n  end\n\n  def display\n  end\n\n  # cleanup method is called (by default) on exit, via ctrl-c or otherwise\n  def cleanup\n  end\n\n  # return_value is used to emit a result from the interface\n  def return_value\n  end\n\n  # respond to specific keypresses with methods like these\n  def key_ctrl_c\n  end\n\n  def key_alt_enter\n  end\n\n  # or respond to general keypresses with methods like these\n  def key_pressed(keystroke)\n  end\n\n  def function_key(keystroke)\n  end\n\n  def character_key(keystroke)\n  end\n\n  # When you're done and it's time to cleanup and exit cleanly, call `finish!`\n  def i_know_im_ready_to_exit\n    finish!\n  end\nend\n```\n\nResponding to keypresses can happen at a few different altitudes depending on your needs. If you just want to respond to a special key or two (enter and ESC) and character keys, you might do this:\n\n```crystal\nclass CoolWidget \u003c Keimeno::Base\n  def key_enter\n  end\n\n  def key_esc\n  end\n\n  def character_key(keystroke)\n  end\nend\n```\n\nFor close-to-readline bindings on your user inputs, the `TextInput` or `Prompt` modules can be included and will render a text input at the cursor location which responds reasonably close to what might be expected from a readline interface.\n\n```crystal\nclass MegaInputDevice \u003c Keimeno::Base\n  include Keimeno::TextInput\n\n  def display\n    print \"What is your favorite color? \"\n  end\n\n  def key_enter\n    finish!\n  end\n\n  def return_value\n    input_text\n  end\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobacarp%2Fkeimeno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobacarp%2Fkeimeno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobacarp%2Fkeimeno/lists"}