Browse Source

add pause and resume subcommands

Touches a file in the homedir.  This should be better thought through.  It
could, for example, store it in the db itself...
master
Brennen Bearnes 2 weeks ago
parent
commit
5c1403ab7c
5 changed files with 23 additions and 5 deletions
  1. +6
    -4
      bin/commandlog
  2. +6
    -0
      bin/commandlog-add
  3. +4
    -0
      bin/commandlog-pause
  4. +6
    -0
      bin/commandlog-resume
  5. +1
    -1
      lib/App/CommandLog.pm

+ 6
- 4
bin/commandlog View File

@ -4,9 +4,11 @@
function print_help() {
echo "Usage: $0 [command] [args]"
echo " $0 add Add a log entry."
echo " $0 log Show log entries."
echo " $0 -h Print this help message"
echo " $0 add Add a log entry"
echo " $0 log Show log entries"
echo " $0 pause Pause logging"
echo " $0 resume Resume logging"
echo " $0 -h Print this help message"
echo
echo "You must specify a command."
exit 1
@ -22,4 +24,4 @@ fi
SUBPROG="commandlog-$1"
shift
exec $SUBPROG "$@"
exec "$SUBPROG" "$@"

+ 6
- 0
bin/commandlog-add View File

@ -27,6 +27,12 @@ use App::CommandLog;
use Cwd;
use Sys::Hostname;
# Bail if logging is paused - can toggle this with commandlog-pause and
# commandlog-resume:
if (-e "$ENV{HOME}/commandlog-paused") {
exit;
}
my $command = $ARGV[0];
my $expanded_command = $ARGV[2];


+ 4
- 0
bin/commandlog-pause View File

@ -0,0 +1,4 @@
#!/bin/sh
echo 'Pausing command logging.'
touch "$HOME/commandlog-paused"

+ 6
- 0
bin/commandlog-resume View File

@ -0,0 +1,6 @@
#!/bin/sh
if [ -f "$HOME/commandlog-paused" ]; then
echo "Resuming command logging."
rm "$HOME/commandlog-paused"
fi

+ 1
- 1
lib/App/CommandLog.pm View File

@ -14,7 +14,7 @@ App::CommandLog - Tools for logging command line history
package App::CommandLog;
our ($VERSION) = '0.4.0';
our ($VERSION) = '0.5.0';
use strict;
use warnings;


Loading…
Cancel
Save