Skip to content

Commit

Permalink
initial cmd_info
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Jun 16, 2024
1 parent 64994ba commit 69bc7a4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@
"args": ["update"],
"console": "integratedTerminal",
"justMyCode": true
}
},
{
"name": "ICM Info",
"type": "debugpy",
"request": "launch",
"program": "icm-run.py",
"args": ["info"],
//"console": "internalConsole",
"console": "integratedTerminal",
"justMyCode": true,
"internalConsoleOptions": "neverOpen",
"preLaunchTask": "Clear terminal",
},
]
}

4 changes: 4 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
},
"problemMatcher": []
},
{
"label": "Clear terminal",
"command": "echo ${command:workbench.action.terminal.clear}"
}

]
}
1 change: 1 addition & 0 deletions icm-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#-- Apio commands finish with this excepcion
except SystemExit:
print("")
print("icm command executed!")

#-- Exit!
Expand Down
8 changes: 7 additions & 1 deletion icm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import click

from icm.commands import cmd_create, cmd_validate, cmd_update
from icm.commands import cmd_create, cmd_validate, cmd_update, cmd_info


@click.group()
Expand All @@ -33,3 +33,9 @@ def update():
def validate():
"""Validate a collection."""
cmd_validate.validate()


@cli.command()
def info():
"""Show system information"""
cmd_info.main()
32 changes: 32 additions & 0 deletions icm/commands/cmd_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""info command"""

# -*- coding: utf-8 -*-
# -- This file is part of the Icestudio project
# -- (C) 2017-19 FPGAwars
# -- Author Jesús Arroyo
# -- (C) 2020-24 FPGAwars
# -- Author Juan Gonzalez (Obijuan)
# -- Licence GPLv2

import platform
import shutil

# -- Terminal width
TERMINAL_WIDTH = shutil.get_terminal_size().columns

# -- Horizontal line
HLINE = "─" * TERMINAL_WIDTH


def main():
"""ENTRY POINT: Show system information"""

print()
print("----------------")
print("icm info")
print("----------------")
print("")

print(HLINE)
print(platform.uname())
print(HLINE)

0 comments on commit 69bc7a4

Please sign in to comment.