diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2010-11-11 15:23:54 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2010-11-11 15:23:54 -0800 |
commit | ec9a597a4e7b98ab54a7d5f049b2f4d1d09d947c (patch) | |
tree | 1687d53af3f9c121a038c0d1becb5b8641b9c3db /lib/Vyatta/ConfigMgmt.pm | |
parent | da5f3fef00f713e8ebbf0f62630eb8a2dbb0977a (diff) | |
download | vyatta-config-mgmt-ec9a597a4e7b98ab54a7d5f049b2f4d1d09d947c.tar.gz vyatta-config-mgmt-ec9a597a4e7b98ab54a7d5f049b2f4d1d09d947c.zip |
Add "show-commit-log-brief" for tab completion.
Diffstat (limited to 'lib/Vyatta/ConfigMgmt.pm')
-rw-r--r-- | lib/Vyatta/ConfigMgmt.pm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Vyatta/ConfigMgmt.pm b/lib/Vyatta/ConfigMgmt.pm index 9a0776b..90d2289 100644 --- a/lib/Vyatta/ConfigMgmt.pm +++ b/lib/Vyatta/ConfigMgmt.pm @@ -146,6 +146,7 @@ sub cm_commit_add_log { } sub cm_commit_get_log { + my ($brief) = @_; my @lines = cm_read_file($commit_log_file); @@ -158,13 +159,20 @@ sub cm_commit_get_log { } $line = $1; my ($time, $user, $via, $comment) = split(/\|/, $line); - my $time_str = strftime("%Y-%m-%d %H:%M:%S", localtime($time)); $comment =~ s/\%\%/\|/g; - my $new_line = sprintf("%-2s %s by %s via %s\n", - $count, $time_str, $user, $via); - push @commit_log, $new_line; - if (defined $comment and $comment ne '' and $comment ne 'commit') { - push @commit_log, " $comment\n" + if (defined $brief) { + my $time_str = strftime("%Y-%m-%d_%H:%M:%S", localtime($time)); + $comment = '' if ! defined $comment; + my $new_line = sprintf("%s %s by %s", $time_str, $user, $via); + push @commit_log, $new_line; + } else { + my $time_str = strftime("%Y-%m-%d %H:%M:%S", localtime($time)); + my $new_line = sprintf("%-2s %s by %s via %s\n", + $count, $time_str, $user, $via); + push @commit_log, $new_line; + if (defined $comment and $comment ne '' and $comment ne 'commit') { + push @commit_log, " $comment\n" + } } $count++; } |