fish

How to show content of a function in fish?


In fishshell, I can create and save a function very easy, like:

function aaa
   echo hello
end

funcsave aaa

But how to view the body of the function aaa from command line easily? Is there any way other than:

echo ~/.config/fish/functions/aaa.fish

Solution

  • invoke functions aaa on command line

    username@MacBook-Pro ~> functions aaa
    function aaa
        echo hello
    end
    username@MacBook-Pro ~>
    

    Some more uses of functions command

    functions -n
    # Displays a list of currently-defined functions
    
    functions -c foo bar
    # Copies the 'foo' function to a new function called 'bar'
    
    functions -e bar
    # Erases the function `bar`