如何在 fish 中显示函数的内容?

How to show content of a function in fish?

fishshell中,我可以很容易地创建和保存函数,例如:

function aaa
   echo hello
end

funcsave aaa

但是如何从命令行方便地查看函数体aaa呢?除了:

还有什么办法吗
echo ~/.config/fish/functions/aaa.fish

在命令行上调用 functions aaa

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

函数命令的更多用法

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`

此外,type aaa 将向您展示函数定义,并带有一些序言:

$ type aaa
aaa is a function with definition
function aaa
    echo hello
end