Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better UI for command line launch #829

Merged
merged 6 commits into from
Jan 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Launch cli: Allow answers to be deleted
  • Loading branch information
ewels committed Jan 14, 2021
commit ee7e9717e158dc5e695145717e80a3d8ef2baff0
18 changes: 13 additions & 5 deletions nf_core/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def prompt_schema(self):
for param_id, param_obj in self.schema_obj.schema.get("properties", {}).items():
if not param_obj.get("hidden", False) or self.show_hidden:
is_required = param_id in self.schema_obj.schema.get("required", [])
answers.update(self.prompt_param(param_id, param_obj, is_required, answers))
answers = self.prompt_param(param_id, param_obj, is_required, answers)

# Split answers into core nextflow options and params
for key, answer in answers.items():
Expand All @@ -412,10 +412,18 @@ def prompt_param(self, param_id, param_obj, is_required, answers):
log.error("'–-{}' is required".format(param_id))
answer = questionary.unsafe_prompt([question], style=nfcore_question_style)

# Don't return empty answers
# Ignore if empty
if answer[param_id] == "":
return {}
return answer
answer = {}

# Previously entered something but this time we deleted it
if param_id not in answer and param_id in answers:
answers.pop(param_id)
# Everything else (first time answer no response or normal response)
else:
answers.update(answer)

return answers

def prompt_group(self, group_id, group_obj):
"""
Expand Down Expand Up @@ -485,7 +493,7 @@ def prompt_group(self, group_id, group_obj):
else:
param_id = answer[group_id]
is_required = param_id in group_obj.get("required", [])
answers.update(self.prompt_param(param_id, group_obj["properties"][param_id], is_required, answers))
answers = self.prompt_param(param_id, group_obj["properties"][param_id], is_required, answers)

return answers

Expand Down