mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 19:53:22 +08:00
[snippets] added: !py help command for interactive help
git-svn-id: https://pykd.svn.codeplex.com/svn@63842 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
52a250ab89
commit
476d864544
59
snippets/help.py
Normal file
59
snippets/help.py
Normal file
@ -0,0 +1,59 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
import sys
|
||||
import pykd
|
||||
|
||||
from pykd import dprintln
|
||||
|
||||
|
||||
def getFuncs():
|
||||
|
||||
funcs = sorted( [ item for item in pykd.__dict__.values() if type(item).__name__ == "function" ],
|
||||
key=lambda x: x.__name__ )
|
||||
|
||||
return funcs
|
||||
|
||||
def getClasses():
|
||||
|
||||
classes = sorted( [ item for item in pykd.__dict__.values() if type(item).__name__ == "class" ],
|
||||
key=lambda x: x.__name__ )
|
||||
|
||||
return classes
|
||||
|
||||
|
||||
|
||||
def printContent():
|
||||
|
||||
dprintln( "\nPYKD API Help\n")
|
||||
|
||||
|
||||
funcs = getFuncs()
|
||||
|
||||
dprintln( "\n<u>FUNCTIONS</u>\n", True )
|
||||
|
||||
for f in funcs:
|
||||
dprintln( "<link cmd=\"!py help %s\">%s</link>" %( f.__name__, f.__name__ ), True )
|
||||
|
||||
classes = getClasses()
|
||||
|
||||
dprintln( "\n<u>CLASSES</u>\n", True )
|
||||
|
||||
for c in classes:
|
||||
dprintln( "<link cmd=\"!py help %s\">%s</link>" %( c.__name__, c.__name__ ), True )
|
||||
|
||||
|
||||
def printDetail( name ):
|
||||
|
||||
if name in pykd.__dict__:
|
||||
help( "pykd.%s" % name )
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv)<=1:
|
||||
printContent()
|
||||
if len(sys.argv)==2:
|
||||
printDetail(sys.argv[1])
|
||||
|
Loading…
Reference in New Issue
Block a user