Skip to content

Commit 3bc0de1

Browse files
committed
Bug fixed: apio main help: output reformated
1 parent f538c23 commit 3bc0de1

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-10
lines changed

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"name": "Apio",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"program": "${file}",
9+
"console": "internalConsole",
10+
"justMyCode": true
11+
},
412
{
513
"name": "Apio build",
614
"type": "debugpy",

apio/__main__.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,43 @@ def cli(ctx):
137137
_help, ["boards", "config", "examples", "raw", "system", "upgrade"]
138138
)
139139

140-
# -- Reformat the Help string
141-
_help = "\n".join(_help)
142-
_help = _help.replace("Commands:\n", "Project commands:\n")
143-
_help += "\n\nSetup commands:\n"
144-
_help += "\n".join(setup_help)
145-
_help += "\n\nUtility commands:\n"
146-
_help += "\n".join(util_help)
147-
_help += "\n"
148-
149-
click.secho(_help)
140+
# -- Project commands:
141+
cmd_help = find_commands_help(
142+
_help,
143+
[
144+
"build",
145+
"clean",
146+
"sim",
147+
"test",
148+
"verify",
149+
"lint",
150+
"time",
151+
"upload",
152+
"graph",
153+
],
154+
)
155+
156+
# -- Get the Help header
157+
index = _help.index("Commands:")
158+
header_help = _help[:index]
159+
160+
# -- Print header
161+
click.secho("\n".join(header_help))
162+
163+
# -- Print project commands:
164+
click.secho("Project commands:")
165+
click.secho("\n".join(cmd_help))
166+
click.secho()
167+
168+
# -- Print Setup commands:
169+
click.secho("Setup commands:")
170+
click.secho("\n".join(setup_help))
171+
click.secho()
172+
173+
# -- Print utility commands:
174+
click.secho("Utility commands:")
175+
click.secho("\n".join(util_help))
176+
click.secho()
150177

151178
# -- If there is a command, it is executed when this function is finished
152179
# -- Debug: print the command invoked

0 commit comments

Comments
 (0)