UrbitEx.Terminal (UrbitEx v0.6.1) View Source

Module with functions to interact with herm, the Urbit virtual terminal. Subscription to herm will trigger an SSE pipeline outputting the return of every statement. Error messages are not shown in that channel, instead there is a separate SSE pipeline called slog. You can access that by running the slog/1 function.

Link to this section Summary

Functions

Send an arrow keystroke to the terminal. Takes a Session Struct, a Channel struct and the arrow to send, in atom form (:up, :down, :left or :right) Returns an {:ok, %HTTPoison.Response{}} tuple.

Send a backspace to the terminal. Takes a Session Struct and a Channel struct. Returns an {:ok, %HTTPoison.Response{}} tuple.

Send a delete keystroke (deleting the key next to the cursor) to the terminal. Takes a Session Struct and a Channel struct. Returns an {:ok, %HTTPoison.Response{}} tuple.

Sends a |hi to an Urbit ship. Useful command to troubleshoot network connections (akin to ping in Unix). Takes a Session Struct, a Channel struct and the Urbit @p to ping. Returns an {:ok, %HTTPoison.Response{}} tuple.

Send an keystroke with the "control" key pressed, to the terminal. Takes a Session Struct, a Channel struct and the key to send. For what it's worth, a tab is equivalent to CTRL+ "i". It gives a lists of functions in the hoon standard library. Returns an {:ok, %HTTPoison.Response{}} tuple.

Send an enter key stroke to the terminal, running the command in the prompt. Takes a Session Struct and a Channel struct. Returns an {:ok, %HTTPoison.Response{}} tuple.

Sends a string to the terminal. Note this only types the string in, it does not enter the command. Takes a Session Struct, a Channel struct and the string to send. Returns an {:ok, %HTTPoison.Response{}} tuple.

Opens a SSE pipeline to receive unprompted Terminal logs and error messages.

Subscribes to herm in order to receive SSE events from it. Takes a Session struct and a Channel struct. Returns :ok

Link to this section Functions

Link to this function

arrow(session, channel, arrow)

View Source

Send an arrow keystroke to the terminal. Takes a Session Struct, a Channel struct and the arrow to send, in atom form (:up, :down, :left or :right) Returns an {:ok, %HTTPoison.Response{}} tuple.

Link to this function

backspace(session, channel)

View Source

Send a backspace to the terminal. Takes a Session Struct and a Channel struct. Returns an {:ok, %HTTPoison.Response{}} tuple.

Link to this function

delete(session, channel)

View Source

Send a delete keystroke (deleting the key next to the cursor) to the terminal. Takes a Session Struct and a Channel struct. Returns an {:ok, %HTTPoison.Response{}} tuple.

Link to this function

hi(session, channel, target)

View Source

Sends a |hi to an Urbit ship. Useful command to troubleshoot network connections (akin to ping in Unix). Takes a Session Struct, a Channel struct and the Urbit @p to ping. Returns an {:ok, %HTTPoison.Response{}} tuple.

Link to this function

mod(session, channel, modifier)

View Source

Send an keystroke with the "control" key pressed, to the terminal. Takes a Session Struct, a Channel struct and the key to send. For what it's worth, a tab is equivalent to CTRL+ "i". It gives a lists of functions in the hoon standard library. Returns an {:ok, %HTTPoison.Response{}} tuple.

Link to this function

return(session, channel)

View Source

Send an enter key stroke to the terminal, running the command in the prompt. Takes a Session Struct and a Channel struct. Returns an {:ok, %HTTPoison.Response{}} tuple.

Link to this function

send_string(session, channel, string)

View Source

Sends a string to the terminal. Note this only types the string in, it does not enter the command. Takes a Session Struct, a Channel struct and the string to send. Returns an {:ok, %HTTPoison.Response{}} tuple.

Opens a SSE pipeline to receive unprompted Terminal logs and error messages.

Link to this function

subscribe(session, channel)

View Source

Subscribes to herm in order to receive SSE events from it. Takes a Session struct and a Channel struct. Returns :ok