NAME
App::BashHistoryUtils - CLI utilities related to bash history file
VERSION
This document describes version 0.06 of App::BashHistoryUtils (from Perl distribution App-BashHistoryUtils), released on 2017-03-21.
DESCRIPTION
This distribution includes the following CLI utilities:
FUNCTIONS
delete_bash_history_entries
Usage:
delete_bash_history_entries(%args) -> [status, msg, result, meta]
Delete matching entries from bash history file.
This function is not exported.
This function supports dry-run operation.
Arguments ('*' denotes required arguments):
histfile => str (default: "/home/s1/.bash_history")
ignore_case => bool
inplace => bool
Replace original bash history file.
invert_match => bool
max_age => duration
Match entries older than a certain age.
min_age => duration
Match entries younger than a certain age.
pattern => re
Match entries using a regex pattern.
strip_timestamp => bool
Strip timestamps.
Special arguments:
-dry_run => bool
Pass -dry_run=>1 to enable simulation mode.
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
each_bash_history_entry
Usage:
each_bash_history_entry(%args) -> [status, msg, result, meta]
Run Perl code for each bash history entry.
This function is not exported.
Arguments ('*' denotes required arguments):
code* => str
Perl code to run for each entry.
Inside the code, you can set
$PRINT
to 0 to suppress the output of the entry. You can modify$_
to modify the entry.$TS
(timestamp) is also available.histfile => str (default: "/home/s1/.bash_history")
ignore_case => bool
invert_match => bool
max_age => duration
Match entries older than a certain age.
min_age => duration
Match entries younger than a certain age.
strip_timestamp => bool
Strip timestamps.
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
grep_bash_history_entries
Usage:
grep_bash_history_entries(%args) -> [status, msg, result, meta]
Show matching entries from bash history file.
This function is not exported.
Arguments ('*' denotes required arguments):
histfile => str (default: "/home/s1/.bash_history")
ignore_case => bool
invert_match => bool
max_age => duration
Match entries older than a certain age.
min_age => duration
Match entries younger than a certain age.
pattern => re
Match entries using a regex pattern.
strip_timestamp => bool
Strip timestamps.
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-BashHistoryUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-BashHistoryUtils.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-BashHistoryUtils
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017, 2016, 2015 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.