App-Rakubrew
view release on metacpan or search on metacpan
lib/App/Rakubrew/Shell/Fish.pm view on Meta::CPAN
if (get_brew_mode() eq 'env') {
my $version = get_global_version();
if ($version && $version ne 'system' && !is_version_broken($version)) {
unshift @path_components, map({ "'$_'" } get_bin_paths($version));
}
}
else { # get_brew_mode() eq 'shim'
unshift @path_components, "'$shim_dir'";
}
$path = join(' ', @path_components);
return <<EOT;
set -x PATH $path
function $brew_name
command $brew_exec internal_hooked Fish \$argv
and eval (command $brew_exec internal_shell_hook Fish post_call_eval \$argv)
end
function _${brew_name}_is_not_register
set args (commandline -poc)
if [ (count \$args) -eq 3 -a \$args[1] = 'register' ]
return 1
else
return 0
end
end
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 " ")'
EOT
}
sub post_call_eval {
my $self = shift;
$self->print_shellmod_code(@_);
}
sub get_path_setter_code {
my $self = shift;
my $path = shift;
my @path_components = split /:/, $path;
@path_components = map { "'$_'" } @path_components;
return "set -gx PATH " . join(' ', @path_components);
}
sub get_shell_setter_code {
my $self = shift;
my $version = shift;
return "set -gx $env_var $version";
}
sub get_shell_unsetter_code {
my $self = shift;
return "set -ex $env_var";
}
sub completions {
my $self = shift;
say join(" ", $self->get_completions($self->strip_executable($#_, @_)));
}
1;
( run in 0.319 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )