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

Added force option to skip prompting the user if they want files deleted #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

byornski
Copy link

@byornski byornski commented Jun 7, 2022

Allows the user to pass a --force flag which skips the confirmation message about deleting files. This is useful for makefile distclean options.

Copy link
Owner

@jsspencer jsspencer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -519,24 +521,28 @@ def diff_tests(tests, diff_program, verbose=1):
diff_popen.wait()
os.chdir(cwd)

def tidy_tests(tests, ndays):
def tidy_tests(tests, ndays, force=False):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: let's use a more meaningful name - force_deletion?

while ans != 'y' and ans != 'n':
ans = testcode2.compatibility.compat_input('Confirm [y/n]: ')
if force:
ans = 'y'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a boolean flag here.

e.g.

if force_deletion:
  delete_files = True
else:
  ...
  delete_files = ans == 'y'

And then we have a clearer test in the next if block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants