Skip to content

Commit bd3d464

Browse files
committed
Update manage.py
1 parent cb9f62e commit bd3d464

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/manage.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def checklinks(app):
139139

140140
@app.command("major", "minor", "patch", "downgrade")
141141
def version(app, field):
142-
"Upgrades or downgrades the project version with respect to the specified argument."
142+
"Upgrades or downgrades the project version with respect to the specified argument ([major], [minor], [patch] or [downgrade])."
143143
with open(version_file, "r") as f:
144144
versions = list(map(lambda x: x[:-1] if x.endswith("\n") else x, f))
145145
if field == "downgrade":
@@ -161,16 +161,19 @@ def version(app, field):
161161

162162
with open(version_file, "w") as f:
163163
f.write("\n".join(versions))
164-
164+
165+
def highlight_arguments(procedure):
166+
return modify_words(procedure[0].__doc__, words = tuple(map(lambda x: f"[{x}]", procedure[1])), style = Styles.BOLD, replacement_rule = lambda x: x[1:-1])
167+
165168
@app.command(*app.procedures, "help")
166169
def help(app, method = None):
167170
"Displays a help message for the given argument."
168171
if method is None:
169172
print("Valid arguments for the application:\n")
170173
for i in app.procedures:
171-
print(f"- {i:<20}" + modify_words(app.procedures[i][0].__doc__, words = tuple(map(lambda x: f"[{x}]", app.procedures[i][1])), style = Styles.BOLD, replacement_rule = lambda x: x[1:-1]))
174+
print(f"- {i:<20}" + highlight_arguments(app.procedures[i]))
172175
else:
173-
print(f"{method}:", modify_words(app.procedures[method][0].__doc__, words = tuple(map(lambda x: f"[{x}]", app.procedures[method][1])), style = Styles.BOLD, replacement_rule = lambda x: x[1:-1]))
176+
print(f"{method}:", highlight_arguments(app.procedures[method]))
174177

175178
if __name__ == "__main__":
176179
import sys

0 commit comments

Comments
 (0)