Commit 5cc1dbb8 authored by Samuel GAIST's avatar Samuel GAIST

[scripts][editor_cli] Add toolchain subcommand to preview a toolchain

parent 62f40dc2
Pipeline #33524 passed with stage
in 12 minutes and 24 seconds
......@@ -48,8 +48,11 @@ from beat.cmdline.decorators import verbosity_option
from ..utils import setup_logger
from ..utils import check_prefix_folders
from ..utils import check_prefix_dataformats
from ..widgets.mainwindow import MainWindow
from ..widgets.assetwidget import AssetWidget
from ..widgets.toolchaineditor import SimpleToolchainPreview
from ..backend.asset import AssetType
from ..backend.asset import Asset
from ..backend.eventfilters import MouseWheelFilter
......@@ -199,3 +202,36 @@ def refresh_env(ctx):
if os.path.exists(environments_file_path):
os.remove(environments_file_path)
dump_environments(environments_file_path)
@editor.group(cls=AliasedGroup)
@click.pass_context
def toolchain(ctx):
"""Toolchain specific commands"""
pass
SHOW_TOOLCHAIN_EPILOG = """\b
Example:
$ beat editor show user/my_toolchain/1
"""
@toolchain.command(epilog=EDIT_EPILOG)
@click.argument("asset_name")
@click.pass_context
@refresh_environment_cache_flag
@raise_on_error
def show(ctx, asset_name):
"""Edit one specific asset"""
app = QApplication(sys.argv)
asset = Asset(ctx.meta["config"].path, AssetType.TOOLCHAIN, asset_name)
preview = SimpleToolchainPreview()
preview.load(asset.declaration)
preview.show()
return app.exec_()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment