historian v0.11.0-beta.3 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. The value MUST be a string as this function is not a macro :)
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.
Permanently delete an archive entry by name.
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.
Opens your archive in an interactive Historian session.
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
Create an archive entry with the given name and value. The value MUST be a string as this function is not a macro :)
Parameters
- entry_name: Name of the new entry.
- entry_value: Value (i.e. content) of the new entry as a string.
Create an archive entry with the given name using the contents of your clipboard.
Parameters
- entry_name: Name of the entry to eval.
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
orpluck/2
. - action_opts: List of arguments for the given action, see an action's documentation for required args.
copy(entry_name)
View Sourcecopy(atom()) :: Historian.Clipboard.copy_result()
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.
delete_entry(entry_name)
View Sourcedelete_entry(archive_entry_name :: atom()) :: :ok
Permanently delete an archive entry by name.
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.
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.
page(pager, page_number)
View Sourcepage(pager :: pid(), page :: non_neg_integer()) :: pid()
page!(pager, page_number)
View Sourcepage!(pager :: pid(), page :: non_neg_integer()) :: pid()
Print the page and update the process's current page to be the provided page number.
pages(page_size \\ 100)
View Sourcepages(page_size :: pos_integer()) :: pid() | {:error, any()}
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(start, stop)
View Sourceselect(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
select(pager, start, stop)
View Sourceselect(pager :: pid(), start :: non_neg_integer(), stop :: non_neg_integer()) :: {:ok, String.t()}
Opens your archive in an interactive Historian session.
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 totrue
will output usingCode.format_string!/1
view_history(lines \\ 100, page \\ 0)
View Sourceview_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
.
view_page(pager, page_number \\ nil)
View Sourceview_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
- pager: The pid for a
Historian.PageBuffer
process. - page: The page to show in the Terminal UI