line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Rakubrew::Shell::Fish; |
2
|
1
|
|
|
1
|
|
7
|
use App::Rakubrew::Shell; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
|
|
|
|
|
|
our @ISA = "App::Rakubrew::Shell"; |
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
15
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
11
|
use App::Rakubrew::Variables; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
157
|
|
9
|
1
|
|
|
1
|
|
12
|
use App::Rakubrew::Tools; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
70
|
|
10
|
1
|
|
|
1
|
|
6
|
use App::Rakubrew::VersionHandling; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
130
|
|
11
|
1
|
|
|
1
|
|
6
|
use App::Rakubrew::Build; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
675
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub supports_hooking { |
14
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
15
|
0
|
|
|
|
|
0
|
1; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub install_note { |
19
|
1
|
|
|
1
|
0
|
342
|
my $text = <
|
20
|
|
|
|
|
|
|
Load $brew_name automatically by adding |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$brew_exec init Fish | source |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
to ~/.config/fish/config.fish |
25
|
|
|
|
|
|
|
This can be easily done using: |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
echo '$brew_exec init Fish | source' >> ~/.config/fish/config.fish |
28
|
|
|
|
|
|
|
EOT |
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
|
|
|
5
|
if ($prefix =~ / /) { |
31
|
0
|
|
|
|
|
0
|
$text .= <
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=================================== WARNING ================================== |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
rakubrews home directory is currently |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$prefix |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
That folder contains spaces. This will break building rakudos as the build |
40
|
|
|
|
|
|
|
system currently doesn't work in such a path. You can work around this problem |
41
|
|
|
|
|
|
|
by changing that folder to a directory without spaces. Do so by putting |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
set -x RAKUBREW_HOME "/some/folder/without/space/rakubrew" |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
in your `~/.config/fish/config.fish` file *before* the `source` line. |
46
|
|
|
|
|
|
|
EOW |
47
|
|
|
|
|
|
|
} |
48
|
1
|
|
|
|
|
16
|
return $text; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get_init_code { |
52
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
53
|
0
|
|
|
|
|
|
my $path = $ENV{PATH}; |
54
|
0
|
|
|
|
|
|
$path = $self->clean_path($path); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my @path_components = split /:/, $path; |
57
|
0
|
|
|
|
|
|
@path_components = map { "'$_'" } @path_components; |
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$path =~ s/:/ /g; |
60
|
0
|
0
|
|
|
|
|
if (get_brew_mode() eq 'env') { |
61
|
0
|
|
|
|
|
|
my $version = get_global_version(); |
62
|
0
|
0
|
0
|
|
|
|
if ($version && $version ne 'system' && !is_version_broken($version)) { |
|
|
|
0
|
|
|
|
|
63
|
0
|
|
|
|
|
|
unshift @path_components, map({ "'$_'" } get_bin_paths($version)); |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { # get_brew_mode() eq 'shim' |
67
|
0
|
|
|
|
|
|
unshift @path_components, "'$shim_dir'"; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$path = join(' ', @path_components); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return <
|
73
|
|
|
|
|
|
|
set -x PATH $path |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
function $brew_name |
76
|
|
|
|
|
|
|
command $brew_exec internal_hooked Fish \$argv |
77
|
|
|
|
|
|
|
and eval (command $brew_exec internal_shell_hook Fish post_call_eval \$argv) |
78
|
|
|
|
|
|
|
end |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
function _${brew_name}_is_not_register |
81
|
|
|
|
|
|
|
set args (commandline -poc) |
82
|
|
|
|
|
|
|
if [ (count \$args) -eq 3 -a \$args[1] = 'register' ] |
83
|
|
|
|
|
|
|
return 1 |
84
|
|
|
|
|
|
|
else |
85
|
|
|
|
|
|
|
return 0 |
86
|
|
|
|
|
|
|
end |
87
|
|
|
|
|
|
|
end |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
complete -c $brew_name -f -n _${brew_name}_is_not_register -a '(command $brew_exec internal_shell_hook Fish completions (commandline -poc) (commandline -ct) | string split " ")' |
90
|
|
|
|
|
|
|
EOT |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub post_call_eval { |
95
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
96
|
0
|
|
|
|
|
|
$self->print_shellmod_code(@_); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub get_path_setter_code { |
100
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
101
|
0
|
|
|
|
|
|
my $path = shift; |
102
|
0
|
|
|
|
|
|
my @path_components = split /:/, $path; |
103
|
0
|
|
|
|
|
|
@path_components = map { "'$_'" } @path_components; |
|
0
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return "set -gx PATH " . join(' ', @path_components); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub get_shell_setter_code { |
108
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
my $version = shift; |
110
|
0
|
|
|
|
|
|
return "set -gx $env_var $version"; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub get_shell_unsetter_code { |
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
115
|
0
|
|
|
|
|
|
return "set -ex $env_var"; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub completions { |
119
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
120
|
0
|
|
|
|
|
|
say join(" ", $self->get_completions($self->strip_executable($#_, @_))); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
124
|
|
|
|
|
|
|
|