Giter Site home page Giter Site logo

extty's Introduction

ExTTY

Hex version CircleCI

Run an Elixir or Erlang shell as a GenServer process

Installation

Install extty by adding it to your list of dependencies in mix.exs:

def deps() do
  [
    {:extty, "~> 0.2"}
  ]
end

Usage

This is heavily adapted from ssh_cli.erl and functions much like the SSH console implementation.

This will start a terminal shell process in a GenServer. You can then send ANSI text to it to behave like a normal TTY. When starting the shell, you must specify a handler pid to receive the returned text data. The incoming message will be formatted as {:tty_data, String.t()}

iex()> {:ok, tty} = ExTTY.start_link(handler: self())
iex()> flush()
{:tty_data, "Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help)\r\n"}
{:tty_data, "iex(1)> "}
iex()> ExTTY.send_text(tty, "1+1\n")
:ok
iex()> flush()
{:tty_data, "1+1\r\n"}
{:tty_data, "\e[33m2\e[0m\r\n"}
{:tty_data, "iex(2)> "}

extty's People

Contributors

fhunleth avatar jjcarstens avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.