{"id":16658148,"url":"https://github.com/jjcarstens/extty","last_synced_at":"2025-04-09T13:07:53.996Z","repository":{"id":37845441,"uuid":"275440027","full_name":"jjcarstens/extty","owner":"jjcarstens","description":"Terminal shell emulation as a process","archived":false,"fork":false,"pushed_at":"2025-03-05T02:17:49.000Z","size":44,"stargazers_count":20,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T03:37:56.425Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","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/jjcarstens.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2020-06-27T19:28:57.000Z","updated_at":"2025-03-05T02:15:56.000Z","dependencies_parsed_at":"2025-03-05T02:31:20.261Z","dependency_job_id":"097ee84a-3f7b-44ed-a798-615ab19a9946","html_url":"https://github.com/jjcarstens/extty","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarstens%2Fextty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarstens%2Fextty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarstens%2Fextty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjcarstens%2Fextty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjcarstens","download_url":"https://codeload.github.com/jjcarstens/extty/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045232,"owners_count":21038553,"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":[],"created_at":"2024-10-12T10:03:26.394Z","updated_at":"2025-04-09T13:07:53.973Z","avatar_url":"https://github.com/jjcarstens.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExTTY\n\n[![Hex version](https://img.shields.io/hexpm/v/extty.svg \"Hex version\")](https://hex.pm/packages/extty)\n[![CircleCI](https://circleci.com/gh/jjcarstens/extty.svg?style=svg)](https://circleci.com/gh/jjcarstens/extty)\n\nRun an Elixir or Erlang shell as a GenServer process\n\n# Installation\n\nInstall `extty` by adding it to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps() do\n  [\n    {:extty, \"~\u003e 0.2\"}\n  ]\nend\n```\n\n# Usage\n\nThis is heavily adapted from [`ssh_cli.erl`](https://github.com/erlang/otp/blob/master/lib/ssh/src/ssh_cli.erl)\nand functions much like the SSH console implementation.\n\nThis will start a terminal shell process in a GenServer. You can then send ANSI text\nto it to behave like a normal TTY. When starting the shell, you must specify a handler\npid to receive the returned text data. The incoming message will be formatted as\n`{:tty_data, String.t()}`\n\n```elixir\n\niex()\u003e {:ok, tty} = ExTTY.start_link(handler: self())\niex()\u003e flush()\n{:tty_data, \"Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help)\\r\\n\"}\n{:tty_data, \"iex(1)\u003e \"}\niex()\u003e ExTTY.send_text(tty, \"1+1\\n\")\n:ok\niex()\u003e flush()\n{:tty_data, \"1+1\\r\\n\"}\n{:tty_data, \"\\e[33m2\\e[0m\\r\\n\"}\n{:tty_data, \"iex(2)\u003e \"}\n```\n\nWhen running in a cluster, a shell process can also be started on a remote node by\npassing the node name to the `remsh` option:\n\n```elixir\niex(foo)1\u003e Node.connect(:bar)\ntrue\niex(foo)2\u003e Node.list()\n[:bar]\niex(foo)3\u003e {:ok, tty} = ExTTY.start_link(handler: self(), remsh: :bar)\niex(foo)4\u003e flush()\n{:tty_data,\n \"Interactive Elixir (1.17.0-dev) - press Ctrl+C to exit (type h() ENTER for help)\\r\\n\"}\n{:tty_data, \"iex(bar)1\u003e \"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjcarstens%2Fextty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjcarstens%2Fextty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjcarstens%2Fextty/lists"}