historian v0.11.0-beta.2 Historian View Source

Functions within this module provide the public interface for Historian.

If it's your first time using Historian please use Historian.view_history/0 or Historian.tui!/0 to setup the persistent archive.

Link to this section Summary

Functions

Create an archive entry with the given name and value.

Create an archive entry with the given name using the contents of your clipboard.

Create an archive entry from the current history buffer, extracting it with given action and action opts.

Copy the entry's contents to your clipboard, returns {:ok, data} if was copied to your clipboard successfully or {:error, reason} if there was a problem.

Turn the entry into a zero-arity function; uses Code.eval_string/1 to call the given lines within the function.

Evaluate the entry and return the result; uses Code.eval_string/1 to obtain the result.

Print the page and update the process's current page to be the provided page number.

Search the current history buffer for lines matching the term and print them to screen.

Search the current history buffer for lines matching the term and print them to screen.

Select the given lines (from the last history buffer) and print them to screen.

Print the contents of the matching archive entry or a message saying there is no matching entry.

Starts an interactive Historian session.

An alias of tui!/0.

Starts an interactive Historian session using the provided page buffer process. If no page number is provided the current page from the given page buffer process will be used.

Link to this section Functions

Link to this function

archive_entry!(entry_name, entry_value)

View Source
archive_entry!(atom(), String.t()) :: String.t()

Create an archive entry with the given name and value.

Parameters

  • entry_name: Name of the new entry
  • entry_value: Value (i.e. content) of the new entry
Link to this function

archive_from_clipboard!(entry_name)

View Source
archive_from_clipboard!(atom()) :: String.t() | {:error, any()}

Create an archive entry with the given name using the contents of your clipboard.

Parameters

  • entry_name: Name of the entry to eval.
Link to this function

archive_from_history!(entry_name, action, action_opts \\ [])

View Source
archive_from_history!(atom(), :pluck | :slice, [any()]) :: String.t()

Create an archive entry from the current history buffer, extracting it with given action and action opts.

Parameters

  • entry_name: Name of the entry to eval.
  • action: Action to use for extracting the value from the history buffer, either slice/3 or pluck/2.
  • action_opts: List of arguments for the given action, see an action's documentation for required args.

Copy the entry's contents to your clipboard, returns {:ok, data} if was copied to your clipboard successfully or {:error, reason} if there was a problem.

Parameters

  • entry_name: Name of the entry to copy.

Usage over SSH

If you want to use Historian on a remote system, you'll need to properly configure SSH or coping lines will fail. Eventually, there will be a guide on how to use Historian with SSH.

Link to this function

entry_to_fun(entry_name)

View Source
entry_to_fun(atom()) :: (() -> any())

Turn the entry into a zero-arity function; uses Code.eval_string/1 to call the given lines within the function.

Parameters

  • entry_name: Name of the entry to turn into a function.
Link to this function

eval_entry(entry_name)

View Source
eval_entry(atom()) :: any()

Evaluate the entry and return the result; uses Code.eval_string/1 to obtain the result.

Parameters

  • entry_name: Name of the entry to eval.
Link to this function

next_page(pager)

View Source
next_page(pager :: pid()) :: pid()
Link to this function

page(pager, page_number)

View Source
page(pager :: pid(), page :: non_neg_integer()) :: pid()
Link to this function

page!(pager, page_number)

View Source
page!(pager :: pid(), page :: non_neg_integer()) :: pid()

Print the page and update the process's current page to be the provided page number.

Link to this function

pages(page_size \\ 100)

View Source
pages(page_size :: pos_integer()) :: pid() | {:error, any()}
Link to this function

pluck(indexes)

View Source
pluck([pos_integer()]) :: {:ok, String.t()}
Link to this function

prev_page(pager)

View Source
prev_page(pager :: pid()) :: pid()
Link to this function

search(matching)

View Source
search(String.t()) :: :ok

Search the current history buffer for lines matching the term and print them to screen.

Link to this function

search(pager, matching)

View Source
search(page_buffer_pid :: pid(), String.t()) :: :ok

Search the current history buffer for lines matching the term and print them to screen.

Link to this function

select(start, stop)

View Source
select(start :: non_neg_integer(), stop :: non_neg_integer()) ::
  {:ok, String.t()}

Select the given lines (from the last history buffer) and print them to screen.

Parameters

  • start: Line number to start selecting lines at
  • stop: Line number to stop selecting lines at
Link to this function

select(pager, start, stop)

View Source
select(pager :: pid(), start :: non_neg_integer(), stop :: non_neg_integer()) ::
  {:ok, String.t()}
Link to this function

view_entry(name, opts \\ [pretty_print: false])

View Source
view_entry(atom(), Keyword.t()) :: :ok

Print the contents of the matching archive entry or a message saying there is no matching entry.

Parameters

  • entry_name: Name of the entry to view.
  • opts: pretty_print: false is the default, setting to true will output using Code.format_string!/1
Link to this function

view_history(lines \\ 100, page \\ 0)

View Source
view_history(non_neg_integer(), non_neg_integer()) :: :ok

Starts an interactive Historian session.

Parameters

  • lines: Number of lines of history to load into the buffer Historian UI.
  • start: Offset for number of lines.

An alias of tui!/0.

Link to this function

view_page(pager, page_number \\ nil)

View Source
view_page(pager :: pid(), non_neg_integer() | nil) :: :ok | {:error, :dead_pid}

Starts an interactive Historian session using the provided page buffer process. If no page number is provided the current page from the given page buffer process will be used.

Parameters