X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Flocal%2Flib.pm;h=6685519d0152b944a7ea0991de747ea20e35a605;hb=ecc3a2eebf44c44f730f094f8ac392ded97c49e4;hp=3b8869a7f0a1c99ba79a9700dcec1b029bbc7589;hpb=c8d004f4107a818b322ea74e2d5c288cc713f73d;p=p5sagit%2Flocal-lib.git diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 3b8869a..6685519 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -13,6 +13,8 @@ $VERSION = eval $VERSION; sub import { my ($class, @args) = @_; + push @args, @ARGV + if $0 eq '-'; my @steps; my %opts; @@ -440,6 +442,16 @@ sub wrap_powershell_output { return $out || " \n"; } +sub build_fish_env_declaration { + my ($class, $name, $args) = @_; + my $value = $class->_interpolate($args, '$%s', '"', '\\%s'); + if (!defined $value) { + return qq{set -e $name;\n}; + } + $value =~ s/$_path_sep/ /; + qq{set -x $name $value;\n}; +} + sub _interpolate { my ($class, $args, $var_pat, $escape, $escape_pat) = @_; return @@ -555,6 +567,7 @@ sub guess_shelltype { for ($shellbin) { return /csh$/ ? 'csh' + : /fish/ ? 'fish' : /command(?:\.com)?$/i ? 'cmd' : /cmd(?:\.exe)?$/i ? 'cmd' : /4nt(?:\.exe)?$/i ? 'cmd'