line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::VTide::Command::Who; |
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
|
|
1479
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
2528
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
11
|
1
|
|
|
1
|
|
5
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
12
|
1
|
|
|
1
|
|
59
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
13
|
1
|
|
|
1
|
|
5
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
14
|
1
|
|
|
1
|
|
379
|
use YAML::Syck; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
15
|
1
|
|
|
1
|
|
5
|
use Path::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
550
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
extends 'App::VTide::Command::Run'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = version->new('1.0.4'); |
20
|
|
|
|
|
|
|
our $NAME = 'who'; |
21
|
|
|
|
|
|
|
our $OPTIONS = [ 'set|s=s', 'term|t=s', 'verbose|v+', ]; |
22
|
|
|
|
|
|
|
our $LOCAL = 1; |
23
|
0
|
|
|
0
|
1
|
|
sub details_sub { return ( $NAME, $OPTIONS, $LOCAL ) } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub run { |
26
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if ( $self->defaults->{set} ) { |
29
|
0
|
|
|
|
|
|
my $file = path( $self->defaults->{set} )->absolute; |
30
|
0
|
|
|
|
|
|
my $dir = $file->parent; |
31
|
0
|
|
|
|
|
|
my $config = LoadFile($file); |
32
|
0
|
|
0
|
|
|
|
my $term = $self->defaults->{term} || 99; |
33
|
0
|
|
|
|
|
|
print <<"EXPORTS"; |
34
|
|
|
|
|
|
|
export VTIDE_NAME="$config->{name}" |
35
|
|
|
|
|
|
|
export VTIDE_CONFIG="$file" |
36
|
|
|
|
|
|
|
export VTIDE_DIR="$dir" |
37
|
|
|
|
|
|
|
export VTIDE_TERM=$term |
38
|
|
|
|
|
|
|
EXPORTS |
39
|
0
|
|
|
|
|
|
$self->config->local_config($file); |
40
|
0
|
|
|
|
|
|
my $conf = $self->config->get(); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ( $conf->{default}{env} ) { |
43
|
0
|
|
|
|
|
|
print "\n"; |
44
|
0
|
|
|
|
|
|
for my $key ( sort keys %{ $conf->{default}{env} } ) { |
|
0
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
print "export $key=\"$conf->{default}{env}{$key}\"\n"; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
0
|
0
|
|
|
|
|
if ( $conf->{terminals}{$term}{env} ) { |
49
|
0
|
|
|
|
|
|
for my $key ( sort keys %{ $conf->{terminals}{$term}{env} } ) { |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
print "export $key=\"$conf->{terminals}{$term}{env}{$key}\"\n"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ( !$ENV{VTIDE_NAME} ) { |
58
|
0
|
|
|
|
|
|
print "Not in a VTide session\n"; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
0
|
|
|
|
|
|
print "Session $ENV{VTIDE_NAME}\n"; |
62
|
0
|
0
|
|
|
|
|
print "Term $ENV{VTIDE_TERM}\n" if $ENV{VTIDE_TERM}; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#VTIDE_CONFIG |
66
|
|
|
|
|
|
|
#VTIDE_DIR |
67
|
|
|
|
|
|
|
#VTIDE_NAME |
68
|
|
|
|
|
|
|
#VTIDE_TERM |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub auto_complete { |
74
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 NAME |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
App::VTide::Command::Who - Tells you about the terminal you are in |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 VERSION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This documentation refers to App::VTide::Command::Who version 1.0.4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
vtide who [[-s|--set] path/to/.vtide.yml] |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
OPTIONS |
94
|
|
|
|
|
|
|
-t --term[=]term-name |
95
|
|
|
|
|
|
|
Terminal name to get/set envirnment variables for |
96
|
|
|
|
|
|
|
-s --set[=]file |
97
|
|
|
|
|
|
|
Set the current terminal to use the supplied config file |
98
|
|
|
|
|
|
|
-v --verbose Show more detailed output |
99
|
|
|
|
|
|
|
--help Show this help |
100
|
|
|
|
|
|
|
--man Show the full man page |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 DESCRIPTION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head3 C<run ()> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Run the command |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 C<auto_complete ()> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Auto completes sub-commands that can have help shown |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 C<details_sub ()> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns the commands details |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
There are no known bugs in this module. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Patches are welcome. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Copyright (c) 2016 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
141
|
|
|
|
|
|
|
All rights reserved. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
144
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
145
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
146
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
147
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |