Skip to content

Commit

Permalink
add no-interactive flag to vp-nextfitruncard
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Dec 6, 2024
1 parent f4467d0 commit 85789d8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions validphys2/src/validphys/scripts/vp_nextfitruncard.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ def process_args():
f"used: {PREPROCESSING_LIMS}"
),
)
parser.add_argument(
"--no-interactive",
action="store_true",
help=("Do not ask for user input on the description key or open the vi editor."),
)
args = parser.parse_args()
return args

Expand Down Expand Up @@ -130,7 +135,10 @@ def main():
# don't enforce any limits.
preproc_lims = None

updated_description = interactive_description(description)
if args.no_interactive:
updated_description = description
else:
updated_description = interactive_description(description)

iterated_runcard_yaml = API.iterated_runcard_yaml(
fit=input_fit, _updated_description=updated_description, _flmap_np_clip_arg=preproc_lims
Expand All @@ -141,9 +149,10 @@ def main():
outfile.write(iterated_runcard_yaml)
log.info("Runcard for iterated fit written to %s.", runcard_path_out.absolute())

# Open new runcard with default editor, or if one is not set, with vi
EDITOR = os.environ.get("EDITOR") if os.environ.get("EDITOR") else "vi"
os.system(f"{EDITOR} {runcard_path_out}")
if not args.no_interactive:
# Open new runcard with default editor, or if one is not set, with vi
EDITOR = os.environ.get("EDITOR") if os.environ.get("EDITOR") else "vi"
os.system(f"{EDITOR} {runcard_path_out}")


if __name__ == "__main__":
Expand Down

0 comments on commit 85789d8

Please sign in to comment.