[ Home | Main Table Of Contents | Table Of Contents | Keyword Index ]

# cmdr::history(n) 0.1 doc "Cmdr, a framework for command line parsing and dispatch"

## Name

cmdr::history - Cmdr - Utilities for history management

## Table Of Contents

## Synopsis

- package require fileutil
- package require cmdr::history

- ::cmdr::history attach actor
- ::cmdr::history save-to path
- ::cmdr::history initial-limit limit

## Description

Welcome to the Cmdr project, written by Andreas Kupries.

For availability please read Cmdr - How To Get The Sources.

This package provides utility commands to manage a command history.

## API

::cmdr::history attach actor

  When invoked this command extends the actor instance (an officer) with the necessary commands (a history officer) and settings to record a history of commands entered for this actor and its subordinate commands, and allow the user to manage this history.

  The result of the command is the empty string.

  cmdr::officer actor

    The officer to extend with history management commands.

  After attachment the actor will accept the following 3 commands:

          history list ?n?  - Show last n history entries. Defaults to all.
          history clear     - Drop all history entries
          history limit ?n? - Limit history to 'n' entries (n >= 0). Unlimited for n < 0.

  Under most circumstances the attachment is handled through the method custom-setup of officers. See cmdr::officer, and the Example for more information.

::cmdr::history save-to path

  When invoked this command sets the package-wide history save file used by the commands to the path.

  The result of the command is the empty string.

::cmdr::history initial-limit limit

  When invoked this command sets the package-wide limit on history size to limit. A value less than zero means "no limit".

  The result of the command is the empty string.

## Example

Below an example on how to activate history for an officer. The example was taken from the fx application extending the fossil DVCS.

    cmdr history initial-limit 20
    cmdr history save-to       ~/.fx_history
    cmdr create fx::fx [file tail $::argv0] {
        custom-setup ::cmdr::history::attach
        [...]
    }

## Bugs, Ideas, Feedback

Both the package(s) and this documentation will undoubtedly contain bugs and other problems. Please report such at Cmdr Tickets.

Please also report any ideas you may have for enhancements of either package(s) and/or documentation.

## Keywords

arguments, command hierarchy, command line completion, command line handling, command tree, editing command line, help for command line, hierarchy of commands, interactive command shell, optional arguments, options, parameters, processing command line, tree of commands

## Copyright

Copyright © 2013-2016 Andreas Kupries
Copyright © 2013-2016 Documentation, Andreas Kupries