Artifact Content
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Artifact 10090bff4422fe1ecb4b7a9dff95bed654804575:

[comment {-*- tcl -*- doctools manpage}]
[include parts/]
[vset VERSION 0.1]
[manpage_begin [vset LABEL_HISTORY] [vset MAN_SECTION] [vset VERSION]]
[include parts/]
[require fileutil]
[require cmdr::history]
[titledesc [vset TITLE_HISTORY]]
[include parts/]

This package provides utility commands to manage a command history.

[section API]
[list_begin definitions]
[comment {- - -- --- ----- -------- -------------}]
[call [cmd ::cmdr::history] [method attach] [arg actor]]

When invoked this command extends the [arg actor] instance
(an officer) with the necessary commands (a [cmd 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.

[para] The result of the command is the empty string.

[list_begin arguments]
[arg_def cmdr::officer actor] The officer to extend with history
management commands.

After attachment the actor will accept the following 3 commands:

[example {
    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 [cmd custom-setup] of officers. See [package cmdr::officer], and
the [sectref Example] for more information.

[comment {- - -- --- ----- -------- -------------}]
[call [cmd ::cmdr::history] [method save-to] [arg path]]

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

[para] The result of the command is the empty string.

[comment {- - -- --- ----- -------- -------------}]
[call [cmd ::cmdr::history] [method initial-limit] [arg limit]]

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

[para] The result of the command is the empty string.


[section Example]

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

[example {
cmdr history initial-limit 20
cmdr history save-to       ~/.fx_history

cmdr create fx::fx [file tail $::argv0] {
    custom-setup ::cmdr::history::attach


[include parts/]