1
votes

I would like to be able to do this:

bat misc | rg -v -e 'TXT|txt' | map path_explode

where

function map
   while read line       
      command $argv $line 
   end
end

and

function path_explode --description 'Return filename, ext, and directory from the path'
    echo $argv[1] | sed 's/\(.*\)\/\(.*\)\.\(.*\)$/\2\n\3\n\1/'
end

does that make sense? I get this error:

fish: Unknown command: path_explode
fish: 
command $argv $line 
        ^
in function 'map' with arguments 'path_explode'
2

2 Answers

0
votes

In fish 3 or later, variables can be used directly as commands, so you don't need eval or command in your map function.

-1
votes

ohh I just need to use eval instead of command

cool :)