Zoidberg::Fish::Log - History and log plugin for Zoidberg
This module is a Zoidberg plugin, see Zoidberg::Fish for details.
This plugin listens to the 'prompt' event and records all input in the history log.
If multiple instances of zoid are using the same history file their histories will be merged.
TODO option for more bash like behaviour
None by default.
Unless this config is set no commands are recorded.
File to store the history. Defaults to "~/.%s.log.yaml" where '%s' is replaced with the program name. Hence the default for zoid is ~/.zoid.log.yaml.
Maximum number of lines in the history. If not set the environment variable 'HISTSIZE' is used. In fact the number of lines can be a bit more then this value on run time because the file is not purged after every write.
If set a command will not be saved if it is the same as the previous command.
Hash with log types mapped to a number representing the maximal number of lines to keep in memory for this type. In contrast to the commandline history, history arrays for these types are completely managed by this module.
"Fix command", this builtin allows you to edit and re-execute commands from the history. first and last are either command numbers or strings matching the beginning of a command; a negative number is used to designate commands by counting back from the current one. Use the '-l' option to list the commands in the history, and the '-n' switch to surpress the command numbers in the listing.The '-r' switch reverses the order of the commands. The '-s' switch re-executes the commands without editing.
first and last default to '-16' and '-1' when the '-l' option is given. Otherwise first defaults to '-1' and last defaults to first.
Note that the selection of the editor is not POSIX compliant but follows bash, if no editor is given using the '-e' option the environment variables 'FCEDIT' and 'EDITOR' are both checked, if neither is set, vi is used. ( According to POSIX we should use 'ed' by default and probably ignore the 'EDITOR' varaiable, but I don't think that is "What You Want" )
Following zsh setting the editor to '-' is identical with using the -s switch.
Also note that fc removes itself from the history and adds the resulting command instead.
Typically r is aliased to 'fc -s' so r will re-execute the last command, optionally followed by a substitution and/or a string to match the begin of the command.
TODO: regex/glob substitution for '-s' switch; now only does string substitution.
Returns (a part of) the history. By default it tries to find the commandline history (depending on GetHistory), but the '--read' option forces reading the history file. To get other log types, like 'pwd', use the '--type' option. The '--nonu' option surpressees line numbering for the terminal output.
The arguments first and last can either be a positive or negative integer, representing the command number or reverse offset, or a string matching the begin of the command. If only one integer is given last defaults to '-1'; if only one string is given last defaults to first. As a bonus you can supply a regex reference instead of a string when using the perl interface.
Note that unlike fc the history command is not specified by posix and the implementation varies widely for different shells. In zoid, fc is build on top of history, so options for history are chosen consistently with fc.
Adds string to the history file with the current timestamp and the supplied type tag. The type defaults to "log". If the type is set to "hist" the entry will become part of the command history after the history file is read again.
Jaap Karssenberg (Pardus) <firstname.lastname@example.org>
Copyright (c) 2011 Jaap G Karssenberg and Joel Berger. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.