Archelon Client API

For convenient reference in development, here are the Archelon client API docs.

Data Module

Data modeling for command history to be modular

exception archelonc.data.ArcheloncAPIException[source]

Bases: archelonc.data.ArcheloncException

API exception occurred.

exception archelonc.data.ArcheloncConnectionException[source]

Bases: archelonc.data.ArcheloncException

Connection exception class.

exception archelonc.data.ArcheloncException[source]

Bases: exceptions.Exception

Base archelonc exception class.

class archelonc.data.HistoryBase[source]

Bases: object

Base class of what all backend command history searches should use.

search_forward(term, page=0)[source]

Return a list of commmands that is in forward time order. i.e oldest first.

If paging is needed, the page parameter is available.

search_reverse(term, page=0)[source]

Return a list of commmands that is in reverse time order. i.e newest first.

If paging is needed, the page parameter is available.

class archelonc.data.LocalHistory[source]

Bases: archelonc.data.HistoryBase

Use local .bash_history for doing searches

search_forward(term, page=0)[source]

Return a list of commmands that is in forward time order. i.e oldest first.

search_reverse(term, page=0)[source]

Return reversed filtered list by term

class archelonc.data.WebHistory(url, token)[source]

Bases: archelonc.data.HistoryBase

Use RESTful API to do searches against archelond.

SEARCH_URL = u'/api/v1/history'
add(command)[source]

Post a command to the remote server using the API

Raises:
all(page)[source]

Return the entire data set available, one page at a time

Raises:
bulk_add(commands)[source]

Post a list of commands

Parameters:

commands (list) – List of commands to add to server.

Raises:
delete(command)[source]

Deletes the command given on the server.

Raises:
Returns:

None

search_forward(term, page=0)[source]

Return a list of commmands that is in forward time order. i.e oldest first.

Raises:
search_reverse(term, page=0)[source]

Make request to API with sort order specified and return the results as a list.

Raises:

Search Module

npyscreen based application for searching shell history

class archelonc.search.CommandBox(screen, **kwargs)[source]

Bases: npyscreen.wgtitlefield.TitleText

Command Box widget

when_value_edited()[source]

Mark myself as having been edited

class archelonc.search.Search[source]

Bases: npyscreen.apNPSApplicationManaged.NPSAppManaged

Search application. Determines which form to show.

more = True
onStart()[source]

Startup routine for the search application

page = 0
class archelonc.search.SearchBox(screen, begin_entry_at=16, field_width=None, value=None, use_two_lines=None, hidden=False, labelColor='LABEL', allow_override_begin_entry_at=True, **keywords)[source]

Bases: npyscreen.wgtitlefield.TitleText

Search box command, updates trigger deeper searching.

search(page=0)[source]

Do the search and return the results

when_value_edited()[source]

Do the search and filter the search result list based on what is returned

class archelonc.search.SearchForm(*args, **kwargs)[source]

Bases: npyscreen.fmFormWithMenus.ActionFormWithMenus

Command history search form

afterEditing()[source]

This is the only form to display, so set next to None

beforeEditing()[source]

Set the edit index to the search box and tell it to preserve the value

create()[source]

Build the form for searching

forward_order()[source]

Change sort order to forward

on_cancel(*_)[source]

Drop out with a non 0 exit code so the wrapper doesn’t execute anything

on_ok(*_)[source]

We just drop the command into a known file for the wrapper to pick up

reverse_order()[source]

Change sort order to forward

class archelonc.search.SearchResult(screen, value='', highlight_color='CURSOR', highlight_whole_widget=False, invert_highlight_color=True, **keywords)[source]

Bases: npyscreen.wgtextbox.Textfield

Search result item

update(clear=True)[source]

Update search results include getting the next page.

class archelonc.search.SearchResults(*args, **keywords)[source]

Bases: npyscreen.wgmultiline.MultiLineAction

MultiLine widget for displaying search results.

actionHighlighted(act_on_this, key_press)[source]

Command Module

Command line entry points for the archelon client.

archelonc.command.export_history()[source]

Pull all remote history down into a file specified or stdout if none is specified

archelonc.command.import_history()[source]

Import current shell’s history into server

archelonc.command.search_form()[source]

Entry point to search history

archelonc.command.update()[source]

Capture diff between stored history and new history and upload the delta.