line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Complete::Env; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2015-11-29'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.38'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
22395
|
use 5.010001; |
|
1
|
|
|
|
|
3
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
120
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
839
|
use Complete::Common qw(:all); |
|
1
|
|
|
|
|
549
|
|
|
1
|
|
|
|
|
1363
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
13
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
15
|
|
|
|
|
|
|
complete_env |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our %SPEC; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$SPEC{':package'} = { |
21
|
|
|
|
|
|
|
v => 1.1, |
22
|
|
|
|
|
|
|
summary => 'Completion routines related to environment variables', |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$SPEC{complete_env} = { |
26
|
|
|
|
|
|
|
v => 1.1, |
27
|
|
|
|
|
|
|
summary => 'Complete from environment variables', |
28
|
|
|
|
|
|
|
description => <<'_', |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
On Windows, environment variable names are all converted to uppercase. You can |
31
|
|
|
|
|
|
|
use case-insensitive option (`ci`) to match against original casing. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
_ |
34
|
|
|
|
|
|
|
args => { |
35
|
|
|
|
|
|
|
word => { schema=>[str=>{default=>''}], pos=>0, req=>1 }, |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
result_naked => 1, |
38
|
|
|
|
|
|
|
result => { |
39
|
|
|
|
|
|
|
schema => 'array', |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
sub complete_env { |
43
|
|
|
|
|
|
|
require Complete::Util; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my %args = @_; |
46
|
|
|
|
|
|
|
my $word = $args{word} // ""; |
47
|
|
|
|
|
|
|
if ($word =~ /^\$/) { |
48
|
|
|
|
|
|
|
Complete::Util::complete_array_elem( |
49
|
|
|
|
|
|
|
word=>$word, array=>[map {"\$$_"} keys %ENV], |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} else { |
52
|
|
|
|
|
|
|
Complete::Util::complete_array_elem( |
53
|
|
|
|
|
|
|
word=>$word, array=>[keys %ENV], |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
# ABSTRACT: Completion routines related to environment variables |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |