line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::VTide::Command::Recent; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2016-03-22 15:42:06 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
958
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
10
|
1
|
|
|
1
|
|
2546
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
11
|
1
|
|
|
1
|
|
5
|
use version; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
59
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
13
|
1
|
|
|
1
|
|
5
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
14
|
1
|
|
|
1
|
|
386
|
use YAML::Syck; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
365
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'App::VTide::Command::Run'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = version->new('1.0.4'); |
19
|
|
|
|
|
|
|
our $NAME = 'recent'; |
20
|
|
|
|
|
|
|
our $OPTIONS = [ |
21
|
|
|
|
|
|
|
'number|n=i', |
22
|
|
|
|
|
|
|
'verbose|v+', |
23
|
|
|
|
|
|
|
]; |
24
|
0
|
|
|
0
|
1
|
|
sub details_sub { return ( $NAME, $OPTIONS )}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub run { |
27
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# look at the history |
30
|
0
|
|
|
|
|
|
my $file = $self->history; |
31
|
0
|
|
0
|
|
|
|
my $sessions = eval { LoadFile( $file ) } || {}; |
32
|
0
|
|
|
|
|
|
my @sessions = sort { $sessions->{sessions}{$a}{time} <=> $sessions->{sessions}{$b}{time} } |
33
|
0
|
|
|
|
|
|
grep { ref $sessions->{sessions}{$_} } |
34
|
0
|
|
|
|
|
|
keys %{ $sessions->{sessions} }; |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
0
|
|
0
|
|
|
|
my $max = $self->defaults->{number} || 10; |
37
|
0
|
0
|
|
|
|
|
$max = scalar @sessions if $max - 1 > @sessions; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
for my $session ((reverse @sessions)[0 .. $max - 1]) { |
40
|
0
|
|
|
|
|
|
print localtime($sessions->{sessions}{$session}{time}) . "\t$session\n"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub auto_complete { |
47
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NAME |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
App::VTide::Command::Recent - List recent App::VTide sessions |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 VERSION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This documentation refers to App::VTide::Command::Recent version 1.0.4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
vtide recent [-f|--force] |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
OPTIONS |
67
|
|
|
|
|
|
|
-n (int) The maximum number of recent sessions to show (Default 10) |
68
|
|
|
|
|
|
|
-v --verbose Show more detailed output |
69
|
|
|
|
|
|
|
--help Show this help |
70
|
|
|
|
|
|
|
--man Show the full man page |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head3 C<run ()> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Run the command |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 C<auto_complete ()> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Auto completes sub-commands that can have help shown |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 C<details_sub ()> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns the commands details |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
There are no known bugs in this module. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Patches are welcome. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright (c) 2016 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
111
|
|
|
|
|
|
|
All rights reserved. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
114
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
115
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
116
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
117
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |