Skip to content

Commit

Permalink
Merge pull request #161 from danielskinstad/master
Browse files Browse the repository at this point in the history
 ENT-8980: The prompt for adding all modules now has yes/y/no/n options, like the other prompts
  • Loading branch information
olehermanse authored Nov 8, 2023
2 parents 55b7941 + 8fc3857 commit 5862616
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions cfbs/cfbs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ def _add_using_url(
if not any(modules):
user_error("no modules available, nothing to do")
if not self.non_interactive:
answer = input(
"Do you want to add all %d of them? [y/N] " % (len(modules))
answer = prompt_user(
non_interactive=self.non_interactive,
prompt="Do you want to add all %d of them?" % (len(modules)),
choices=YES_NO_CHOICES,
default="no",
)
if answer.lower() not in ("y", "yes"):
return
Expand Down
2 changes: 1 addition & 1 deletion cfbs/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def prompt_user(non_interactive, prompt, choices=None, default=None):
if answer == "":
answer = default
elif choices and answer not in choices and answer.lower() not in choices:
print("Invalid value entered, must ve one of: %s" % "/".join(choices))
print("Invalid value entered, must be one of: %s" % "/".join(choices))
answer = None

return answer

0 comments on commit 5862616

Please sign in to comment.