summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/FancyPrompt.pm
blob: d0afc38e86f2f9108390cd9d52a824c32c4db393 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package Reply::Plugin::FancyPrompt;
use strict;
use warnings;
# ABSTRACT: provides a more informative prompt

use base 'Reply::Plugin';

=head1 SYNOPSIS

  ; .replyrc
  [FancyPrompt]

=head1 DESCRIPTION

This plugin enhances the default Reply prompt. Currently, the only difference
is that it includes a counter of the number of lines evaluated so far in the
current session.

=cut

sub new {
    my $class = shift;
    my $self = $class->SUPER::new(@_);
    $self->{counter} = 0;
    return $self;
}

sub prompt {
    my $self = shift;
    my ($next) = @_;
    return $self->{counter} . $next->();
}

sub loop {
    my $self = shift;
    $self->{counter}++;
}

1;