Skip to content

Commit 487e833

Browse files
add accepting multiple pifaces
1 parent c344f92 commit 487e833

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

looper/utils.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -641,20 +641,30 @@ def looper_config_tutorial():
641641
or DEFAULTS["output_dir"]
642642
)
643643

644-
piface_path = (
645-
console.input(
646-
"Path to sample pipeline interface: [yellow](pipeline_interface.yaml)[/yellow] >"
644+
add_more_pifaces = True
645+
piface_paths = []
646+
while add_more_pifaces:
647+
piface_path = (
648+
console.input(
649+
"Add each path to a pipeline interface: [yellow](pipeline_interface.yaml)[/yellow] >"
650+
)
651+
or None
647652
)
648-
or DEFAULTS["piface_path"]
649-
)
653+
if piface_path is None:
654+
if piface_paths == []:
655+
piface_paths.append(DEFAULTS["piface_path"])
656+
add_more_pifaces = False
657+
else:
658+
piface_paths.append(piface_path)
659+
650660
console.print("\n")
651661

652662
console.print(
653663
f"""\
654664
[yellow]pep_config:[/yellow] {cfg['pep_config']}
655665
[yellow]output_dir:[/yellow] {cfg['output_dir']}
656666
[yellow]pipeline_interfaces:[/yellow]
657-
- {piface_path}
667+
- {piface_paths}
658668
"""
659669
)
660670

@@ -670,9 +680,9 @@ def looper_config_tutorial():
670680
if selection == "y":
671681
creating = False
672682

673-
if not os.path.exists(piface_path):
683+
if not os.path.exists(piface_paths[0]):
674684
console.print(
675-
f"[bold red]Warning:[/bold red] File does not exist at [yellow]{piface_path}[/yellow]"
685+
f"[bold red]Warning:[/bold red] File does not exist at [yellow]{piface_paths[0]}[/yellow]"
676686
)
677687
console.print(
678688
"Do you wish to initialize a generic pipeline interface? [bold green]Y[/bold green]/[red]n[/red]..."
@@ -692,7 +702,7 @@ def looper_config_tutorial():
692702
looper_config_dict = {}
693703
looper_config_dict["pep_config"] = cfg["pep_config"]
694704
looper_config_dict["output_dir"] = cfg["output_dir"]
695-
looper_config_dict["pipeline_interfaces"] = [piface_path]
705+
looper_config_dict["pipeline_interfaces"] = [piface_paths]
696706

697707
with open(looper_cfg_path, "w") as fp:
698708
yaml.dump(looper_config_dict, fp)

0 commit comments

Comments
 (0)