diff --git a/legendary/utils/cli.py b/legendary/utils/cli.py new file mode 100644 index 0000000..c044144 --- /dev/null +++ b/legendary/utils/cli.py @@ -0,0 +1,13 @@ +def get_boolean_choice(prompt, default=True): + if default: + yn = 'Y/n' + else: + yn = 'y/N' + + choice = input(f'{prompt} [{yn}]: ') + if not choice: + return default + elif choice[0].lower() == 'y': + return True + else: + return False