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

class archelonc.data.HistoryBase[source]

Bases: object

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

search_forward(term)[source]

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

search_reverse(term)[source]

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

class archelonc.data.LocalHistory[source]

Bases: archelonc.data.HistoryBase

Use local .bash_history for doing searches

search_forward(term)[source]

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

search_reverse(term)[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 = '/api/v1/history'
add(command)[source]

Post a command to the remote server using the API

bulk_add(commands)[source]

Post a list of commands

search_forward(term)[source]

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

search_reverse(term)[source]

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

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.

onStart()[source]

Startup routine for the search application

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()[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, **keywords)[source]

Bases: npyscreen.fmFormWithMenus.ActionFormWithMenus

Command history search form

afterEditing()[source]

This is the 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(*args)[source]

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

on_ok(*args)[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

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.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.