In Bash, if I create a function, I can use the type
command to show me that function definition like so:
# define a function
foo {
echo "bar"
}
# now show me that definition
$ type foo
foo is a function
foo ()
{
echo "bar"
}
Zsh and Fish both have something similar with their functions
commands. I checked the bash-to-xsh page here, but could not find an equivalent. I tried using Python's inspect
, but that didn't work either:
def foo():
echo "bar"
$ foo
<function __main__.foo>
$ import inspect as i
$ i.getsource(foo)
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
OSError: could not get source code
How do you show method definitions in Xonsh?