@@ -26,30 +26,11 @@ def cli(verbose):
2626 logging .getLogger ().setLevel (logging .DEBUG )
2727
2828
29- batch_option = click .option (
30- "-b" , "--batch" , is_flag = True , help = "Run as batch script after creating"
31- )
32-
33- output_option = click .option (
34- "-o" ,
35- "--output" ,
36- type = click .Path (path_type = pathlib .Path , dir_okay = True , file_okay = False ),
37- help = "Write output data to this directory, which will be created if it "
38- "does not exist already." ,
39- )
40-
4129from_saved_option = click .option (
4230 "-f" ,
4331 "--from-saved" ,
4432 is_flag = True ,
45- help = "If batch and server both used, serve datasets from saved Zarrs" ,
46- )
47-
48- keep_option = click .option (
49- "-k" ,
50- "--keep" ,
51- is_flag = True ,
52- help = "Keep container after it has finished running." ,
33+ help = "If --batch and --server both used, serve datasets from saved Zarrs" ,
5334)
5435
5536notebook_argument = click .argument (
@@ -59,17 +40,22 @@ def cli(verbose):
5940 ),
6041)
6142
62- server_option = click .option (
43+
44+ @cli .command (
45+ help = "Create a compute engine script on the host system. "
46+ "The output directory will be used for the generated "
47+ "script, supporting code modules, and any output "
48+ "produced by running the script."
49+ )
50+ @click .option (
51+ "-b" , "--batch" , is_flag = True , help = "Run as batch script after creating"
52+ )
53+ @click .option (
6354 "-s" ,
6455 "--server" ,
6556 is_flag = True ,
6657 help = "Run the script as an xcube server after creating it." ,
6758)
68-
69-
70- @cli .command (help = "Create a compute engine script on the host system" )
71- @batch_option
72- @server_option
7359@from_saved_option
7460@click .option (
7561 "-c" ,
@@ -133,7 +119,7 @@ def image_cli():
133119 type = str ,
134120 default = None ,
135121 help = "Tag to apply to the Docker image. "
136- "If not specified, a timestamp-based tag will be generated automatically" ,
122+ "If not specified, a timestamp-based tag will be generated automatically. " ,
137123)
138124@click .option (
139125 "-a" ,
@@ -168,8 +154,18 @@ def build(
168154
169155
170156@image_cli .command (help = "Run a compute engine image as a Docker container" )
171- @batch_option
172- @server_option
157+ @click .option (
158+ "-b" ,
159+ "--batch" ,
160+ is_flag = True ,
161+ help = "Run the compute engine as a batch script" ,
162+ )
163+ @click .option (
164+ "-s" ,
165+ "--server" ,
166+ is_flag = True ,
167+ help = "Run the compute engine as an xcube server." ,
168+ )
173169@click .option (
174170 "-p" ,
175171 "--port" ,
@@ -179,8 +175,19 @@ def build(
179175 help = "Host port for xcube server (default: 8080). Implies --server." ,
180176)
181177@from_saved_option
182- @output_option
183- @keep_option
178+ @click .option (
179+ "-o" ,
180+ "--output" ,
181+ type = click .Path (path_type = pathlib .Path , dir_okay = True , file_okay = False ),
182+ help = "Write output data to this directory, which will be created if it "
183+ "does not exist already." ,
184+ )
185+ @click .option (
186+ "-k" ,
187+ "--keep" ,
188+ is_flag = True ,
189+ help = "Keep container after it has finished running." ,
190+ )
184191@click .argument ("image" , type = str )
185192@click .pass_context
186193def run (
0 commit comments