correct output for fish shell
[p5sagit/local-lib.git] / lib / local / lib.pm
index a8fc12f..216426b 100644 (file)
@@ -442,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/ /g;
+  qq{set -x $name $value;\n};
+}
+
 sub _interpolate {
   my ($class, $args, $var_pat, $escape, $escape_pat) = @_;
   return
@@ -557,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'