sinewalker / dotfiles

OS X / Linux dotfiles.
MIT License
0 stars 1 forks source link

function to list functions #29

Closed sinewalker closed 6 years ago

sinewalker commented 7 years ago

The function keyword should be similar to the alias keyword and list functions. But it doesn't.

I would like a functions or similar that can list the declared functions, excluding those beginning with an underscore (perhaps a switch --all to include those).

Something based around something like declare -F|awk '!/declare -f _/{print $3}'

or just declare -F|awk '{print $3}' for --all functions

sinewalker commented 7 years ago

Also the whence alias should become a function that can do something similar, perhaps replacing my describe function.

declare -F somefunc|awk '{print "Function: " $1 " in " $3 " line " $2}'

(requires shopt -s extdebug to show file and line details, which extends startup time of dotfiles)

sinewalker commented 6 years ago

describe somefunc; type -a somefunc|tail +2 will show where a function is defined and then list the definition. Perhaps a function list for this, rather than replace whence which is more general as it's just an alias for type -a

sinewalker commented 6 years ago

Following commits close this Issue: