Skip to content

Commit

Permalink
Bug fixed: apio main help: output reformated
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Apr 2, 2024
1 parent f538c23 commit 3bc0de1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Apio",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "internalConsole",
"justMyCode": true
},
{
"name": "Apio build",
"type": "debugpy",
Expand Down
47 changes: 37 additions & 10 deletions apio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,43 @@ def cli(ctx):
_help, ["boards", "config", "examples", "raw", "system", "upgrade"]
)

# -- Reformat the Help string
_help = "\n".join(_help)
_help = _help.replace("Commands:\n", "Project commands:\n")
_help += "\n\nSetup commands:\n"
_help += "\n".join(setup_help)
_help += "\n\nUtility commands:\n"
_help += "\n".join(util_help)
_help += "\n"

click.secho(_help)
# -- Project commands:
cmd_help = find_commands_help(
_help,
[
"build",
"clean",
"sim",
"test",
"verify",
"lint",
"time",
"upload",
"graph",
],
)

# -- Get the Help header
index = _help.index("Commands:")
header_help = _help[:index]

# -- Print header
click.secho("\n".join(header_help))

# -- Print project commands:
click.secho("Project commands:")
click.secho("\n".join(cmd_help))
click.secho()

# -- Print Setup commands:
click.secho("Setup commands:")
click.secho("\n".join(setup_help))
click.secho()

# -- Print utility commands:
click.secho("Utility commands:")
click.secho("\n".join(util_help))
click.secho()

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

0 comments on commit 3bc0de1

Please sign in to comment.