(La)TeX isn't build like Python which can store and build documentation in and from the code itself. You need to figure out which package is defining the macro (aka "commands") and then load the package manual e.g. using texdoc <package name>
. There is no cross-reference from the macros to their packages, besides the one done by Google & Co. TeX also doesn't know namespaces etc. While it is Turing complete it should not be compared with software programming languages, especially not with such which are over 30 years younger.
The closest thing you are looking for is the Perl script texdef
(which can also be installed as latexdef
) which normally shows the definition of macros, but which has also a --find
/ -f
option to display where the given macros are first defined. The catch is that you need to load the packages it should search by yourself. It uses LaTeX internally and loading all installed packages in one document automatically isn't possible. So, e.g. latexdef -f -p hyperref href
tells you the definition of \href
and that it is first defined by url.sty
(which is loaded by hyperref
). This can be used to find you which packages in a list is defining the macro. Unfortunately this is cumbersome, and a web search might be easier and more fruitful.