Yeesh.Session
(Yeesh v0.8.3)
View Source
Per-terminal session state, managed as a GenServer.
Each terminal instance gets its own session holding command history, environment variables, working directory, prompt config, and the Dune sandbox state for Elixir evaluation.
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the full history list.
Gets the current mode.
Gets the current prompt string.
Returns the current session state.
Gets the next history entry (down arrow), optionally filtered by prefix.
Gets the previous history entry (up arrow), optionally filtered by prefix.
Searches history for entries containing query, returning the skip-th match.
Adds a command to the history.
Resets the history navigation index.
Starts a new session under the DynamicSupervisor.
Starts a session linked to the caller.
Updates the session state with the given function.
Types
@type t() :: %Yeesh.Session{ context: map(), cwd: String.t(), dune_session: Yeesh.Sandbox.dune_state(), env: %{required(String.t()) => String.t()}, history: [String.t()], history_index: integer(), history_max_size: pos_integer(), history_prefix: String.t() | nil, mode: :normal | :elixir_repl | :mix_task, prompt: String.t(), started_at: DateTime.t() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns the full history list.
@spec get_mode(pid()) :: :normal | :elixir_repl | :mix_task
Gets the current mode.
Gets the current prompt string.
Returns the current session state.
Gets the next history entry (down arrow), optionally filtered by prefix.
Gets the previous history entry (up arrow), optionally filtered by prefix.
@spec history_search(pid(), String.t(), non_neg_integer()) :: {:ok, String.t()} | :no_match
Searches history for entries containing query, returning the skip-th match.
Adds a command to the history.
@spec reset_history_index(pid()) :: :ok
Resets the history navigation index.
Starts a new session under the DynamicSupervisor.
@spec start_link(keyword()) :: GenServer.on_start()
Starts a session linked to the caller.
Updates the session state with the given function.