From 487ae51b5c9b21dffea1ef9092afc95c6ea31755 Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Sun, 9 Aug 2020 11:43:47 +0300 Subject: [PATCH] +doc --- srcxray.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/srcxray.py b/srcxray.py index f9ded67..12a6492 100755 --- a/srcxray.py +++ b/srcxray.py @@ -1307,20 +1307,32 @@ def doxygen_length(a): 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(): #print('Run', me, 'usage') for m in getmembers(modules[__name__]): if isfunction(m[1]) and m[1].__module__ == __name__: - d = inspect.getdoc(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) - ) + doc(m[1]) print("\nTry this: ") print("cd linux;", me, "unittest") print("\nEmergency termination: ^Z, kill %1")