11import click
22from rich .console import Console
3- from rich .table import Table
4- from rich .panel import Panel
5- from rich import print as rprint
6- import sys
73import os
8- from pathlib import Path
4+ import sys
95
106from .commands .init import init_project
117from .commands .run import run_workflow
128from .commands .validate import validate_workflow
139from .commands .status import show_status
1410from .commands .stop import stop_all
11+ from .commands .inspect import inspect_workflow
1512
1613console = Console ()
14+ DEFAULT_EXEC_TYPE = 'windows' if os .name == 'nt' else 'posix'
1715
1816@click .group ()
1917@click .version_option (version = '1.0.0' , prog_name = 'concore' )
@@ -35,7 +33,7 @@ def init(name, template):
3533@click .argument ('workflow_file' , type = click .Path (exists = True ))
3634@click .option ('--source' , '-s' , default = 'src' , help = 'Source directory' )
3735@click .option ('--output' , '-o' , default = 'out' , help = 'Output directory' )
38- @click .option ('--type' , '-t' , default = 'windows' , type = click .Choice (['windows' , 'posix' , 'docker' ]), help = 'Execution type' )
36+ @click .option ('--type' , '-t' , default = DEFAULT_EXEC_TYPE , type = click .Choice (['windows' , 'posix' , 'docker' ]), help = 'Execution type' )
3937@click .option ('--auto-build' , is_flag = True , help = 'Automatically run build after generation' )
4038def run (workflow_file , source , output , type , auto_build ):
4139 """Run a concore workflow"""
@@ -58,6 +56,18 @@ def validate(workflow_file, source):
5856 console .print (f"[red]Error:[/red] { str (e )} " )
5957 sys .exit (1 )
6058
59+ @cli .command ()
60+ @click .argument ('workflow_file' , type = click .Path (exists = True ))
61+ @click .option ('--source' , '-s' , default = 'src' , help = 'Source directory' )
62+ @click .option ('--json' , 'output_json' , is_flag = True , help = 'Output in JSON format' )
63+ def inspect (workflow_file , source , output_json ):
64+ """Inspect a workflow file and show its structure"""
65+ try :
66+ inspect_workflow (workflow_file , source , output_json , console )
67+ except Exception as e :
68+ console .print (f"[red]Error:[/red] { str (e )} " )
69+ sys .exit (1 )
70+
6171@cli .command ()
6272def status ():
6373 """Show running concore processes"""
0 commit comments