1313from . import __version__
1414
1515console = Console ()
16- DEFAULT_EXEC_TYPE = 'windows' if os .name == 'nt' else 'posix'
16+ DEFAULT_EXEC_TYPE = "windows" if os .name == "nt" else "posix"
17+
1718
1819@click .group ()
19- @click .version_option (version = __version__ , prog_name = ' concore' )
20+ @click .version_option (version = __version__ , prog_name = " concore" )
2021def cli ():
2122 pass
2223
24+
2325@cli .command ()
24- @click .argument (' name' , required = True )
25- @click .option (' --template' , default = ' basic' , help = ' Template type to use' )
26+ @click .argument (" name" , required = True )
27+ @click .option (" --template" , default = " basic" , help = " Template type to use" )
2628def init (name , template ):
2729 """Create a new concore project"""
2830 try :
@@ -31,12 +33,21 @@ def init(name, template):
3133 console .print (f"[red]Error:[/red] { str (e )} " )
3234 sys .exit (1 )
3335
36+
3437@cli .command ()
35- @click .argument ('workflow_file' , type = click .Path (exists = True ))
36- @click .option ('--source' , '-s' , default = 'src' , help = 'Source directory' )
37- @click .option ('--output' , '-o' , default = 'out' , help = 'Output directory' )
38- @click .option ('--type' , '-t' , default = DEFAULT_EXEC_TYPE , type = click .Choice (['windows' , 'posix' , 'docker' ]), help = 'Execution type' )
39- @click .option ('--auto-build' , is_flag = True , help = 'Automatically run build after generation' )
38+ @click .argument ("workflow_file" , type = click .Path (exists = True ))
39+ @click .option ("--source" , "-s" , default = "src" , help = "Source directory" )
40+ @click .option ("--output" , "-o" , default = "out" , help = "Output directory" )
41+ @click .option (
42+ "--type" ,
43+ "-t" ,
44+ default = DEFAULT_EXEC_TYPE ,
45+ type = click .Choice (["windows" , "posix" , "docker" ]),
46+ help = "Execution type" ,
47+ )
48+ @click .option (
49+ "--auto-build" , is_flag = True , help = "Automatically run build after generation"
50+ )
4051def run (workflow_file , source , output , type , auto_build ):
4152 """Run a concore workflow"""
4253 try :
@@ -45,9 +56,10 @@ def run(workflow_file, source, output, type, auto_build):
4556 console .print (f"[red]Error:[/red] { str (e )} " )
4657 sys .exit (1 )
4758
59+
4860@cli .command ()
49- @click .argument (' workflow_file' , type = click .Path (exists = True ))
50- @click .option (' --source' , '-s' , default = ' src' , help = ' Source directory' )
61+ @click .argument (" workflow_file" , type = click .Path (exists = True ))
62+ @click .option (" --source" , "-s" , default = " src" , help = " Source directory" )
5163def validate (workflow_file , source ):
5264 """Validate a workflow file"""
5365 try :
@@ -58,10 +70,11 @@ def validate(workflow_file, source):
5870 console .print (f"[red]Error:[/red] { str (e )} " )
5971 sys .exit (1 )
6072
73+
6174@cli .command ()
62- @click .argument (' workflow_file' , type = click .Path (exists = True ))
63- @click .option (' --source' , '-s' , default = ' src' , help = ' Source directory' )
64- @click .option (' --json' , ' output_json' , is_flag = True , help = ' Output in JSON format' )
75+ @click .argument (" workflow_file" , type = click .Path (exists = True ))
76+ @click .option (" --source" , "-s" , default = " src" , help = " Source directory" )
77+ @click .option (" --json" , " output_json" , is_flag = True , help = " Output in JSON format" )
6578def inspect (workflow_file , source , output_json ):
6679 """Inspect a workflow file and show its structure"""
6780 try :
@@ -70,6 +83,7 @@ def inspect(workflow_file, source, output_json):
7083 console .print (f"[red]Error:[/red] { str (e )} " )
7184 sys .exit (1 )
7285
86+
7387@cli .command ()
7488def status ():
7589 """Show running concore processes"""
@@ -79,8 +93,9 @@ def status():
7993 console .print (f"[red]Error:[/red] { str (e )} " )
8094 sys .exit (1 )
8195
96+
8297@cli .command ()
83- @click .confirmation_option (prompt = ' Stop all running concore processes?' )
98+ @click .confirmation_option (prompt = " Stop all running concore processes?" )
8499def stop ():
85100 """Stop all running concore processes"""
86101 try :
@@ -89,10 +104,11 @@ def stop():
89104 console .print (f"[red]Error:[/red] { str (e )} " )
90105 sys .exit (1 )
91106
107+
92108@cli .command ()
93- @click .argument (' study_dir' , type = click .Path (exists = True ))
94- @click .option (' --interval' , '-n' , default = 2.0 , help = ' Refresh interval in seconds' )
95- @click .option (' --once' , is_flag = True , help = ' Print a single snapshot and exit' )
109+ @click .argument (" study_dir" , type = click .Path (exists = True ))
110+ @click .option (" --interval" , "-n" , default = 2.0 , help = " Refresh interval in seconds" )
111+ @click .option (" --once" , is_flag = True , help = " Print a single snapshot and exit" )
96112def watch (study_dir , interval , once ):
97113 """Watch a running simulation study for live monitoring"""
98114 try :
@@ -101,5 +117,6 @@ def watch(study_dir, interval, once):
101117 console .print (f"[red]Error:[/red] { str (e )} " )
102118 sys .exit (1 )
103119
104- if __name__ == '__main__' :
120+
121+ if __name__ == "__main__" :
105122 cli ()
0 commit comments