forked from OpenSDV/Linux_Kernel_map4vehicle
+doc
This commit is contained in:
parent
5be6846111
commit
487ae51b5c
32
srcxray.py
32
srcxray.py
|
@ -1307,20 +1307,32 @@ def doxygen_length(a):
|
||||||
return g
|
return g
|
||||||
|
|
||||||
|
|
||||||
|
def doc(m=None):
|
||||||
|
full = False
|
||||||
|
if not m:
|
||||||
|
m = (dict((name, func) for name, func
|
||||||
|
in getmembers(modules[__name__]))[stack()[1][3]])
|
||||||
|
full = True
|
||||||
|
d = inspect.getdoc(m)
|
||||||
|
if not d:
|
||||||
|
return False
|
||||||
|
if full:
|
||||||
|
print('\033[1m' + m.__name__ + '\033[0m' +
|
||||||
|
str(inspect.signature(m)) + ' -',
|
||||||
|
d.replace('Ex:',
|
||||||
|
'\033[3mExample:\033[0m ' + me + ' ' + m.__name__).
|
||||||
|
replace('Ex2:',
|
||||||
|
'\033[3mExample:\033[0m ' + me)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
print(m.__name__, '-', d.partition('\n')[0])
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
#print('Run', me, 'usage')
|
#print('Run', me, 'usage')
|
||||||
for m in getmembers(modules[__name__]):
|
for m in getmembers(modules[__name__]):
|
||||||
if isfunction(m[1]) and m[1].__module__ == __name__:
|
if isfunction(m[1]) and m[1].__module__ == __name__:
|
||||||
d = inspect.getdoc(m[1])
|
doc(m[1])
|
||||||
if not d:
|
|
||||||
continue
|
|
||||||
print('\n\033[1m' + m[1].__name__ + '\033[0m' +
|
|
||||||
str(inspect.signature(m[1])) + ' -',
|
|
||||||
d.replace('Ex:',
|
|
||||||
'\033[3mExample:\033[0m ' + me + ' ' + m[1].__name__).
|
|
||||||
replace('Ex2:',
|
|
||||||
'\033[3mExample:\033[0m ' + me)
|
|
||||||
)
|
|
||||||
print("\nTry this: ")
|
print("\nTry this: ")
|
||||||
print("cd linux;", me, "unittest")
|
print("cd linux;", me, "unittest")
|
||||||
print("\nEmergency termination: ^Z, kill %1")
|
print("\nEmergency termination: ^Z, kill %1")
|
||||||
|
|
Loading…
Reference in New Issue