Skip to content

Commit

Permalink
change accepted user inputs when loading app and added buttons for ex…
Browse files Browse the repository at this point in the history
…tension
  • Loading branch information
LeonOstrez committed Dec 9, 2023
1 parent c0e68ce commit 6340fe2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pilot/helpers/Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
from typing import Tuple

from const.messages import CHECK_AND_CONTINUE, AFFIRMATIVE_ANSWERS
from const.messages import CHECK_AND_CONTINUE, AFFIRMATIVE_ANSWERS, NEGATIVE_ANSWERS
from utils.style import color_yellow_bold, color_cyan, color_white_bold, color_green
from const.common import IGNORE_FOLDERS, STEPS
from database.database import delete_unconnected_steps_from, delete_all_app_development_data, update_app_status
Expand Down Expand Up @@ -116,18 +116,19 @@ def start(self):
delete_all_app_development_data(self.args['app_id'])
self.skip_steps = False
elif self.skip_until_dev_step is not None:
should_overwrite_files = ''
while should_overwrite_files.lower() not in ['y', 'n']:
should_overwrite_files = None
while should_overwrite_files is None or should_overwrite_files.lower() not in AFFIRMATIVE_ANSWERS + NEGATIVE_ANSWERS:
print('yes/no', type='button')
should_overwrite_files = styled_text(
self,
f'Do you want to overwrite the dev step {self.args["skip_until_dev_step"]} code with system changes? Type y/n',
ignore_user_input_count=True
)

logger.info('should_overwrite_files: %s', should_overwrite_files)
if should_overwrite_files == 'n':
if should_overwrite_files in NEGATIVE_ANSWERS:
break
elif should_overwrite_files == 'y':
elif should_overwrite_files in AFFIRMATIVE_ANSWERS:
FileSnapshot.delete().where(
FileSnapshot.app == self.app and FileSnapshot.development_step == self.skip_until_dev_step).execute()
self.save_files_snapshot(self.skip_until_dev_step)
Expand Down

0 comments on commit 6340fe2

Please sign in to comment.