Update repoclean (#976)

* Update repoclean

Added --auto flag

* Update repoclean

added missed recommended changes
This commit is contained in:
macmule
2020-01-29 05:38:31 +00:00
committed by GitHub
parent 1f3ac5f2eb
commit 2c659b146e

View File

@@ -408,15 +408,20 @@ class RepoCleaner(object):
self.find_cleanup_items()
if self.items_to_delete:
print()
answer = get_input(
'Delete pkginfo and pkg items marked as [to be DELETED]? '
'WARNING: This action cannot be undone. [y/N] ')
if answer.lower().startswith('y'):
if not self.options.auto:
answer = get_input(
'Are you sure? This action cannot be undone. [y/N] ')
'Delete pkginfo and pkg items marked as [to be DELETED]? '
'WARNING: This action cannot be undone. [y/N] ')
if answer.lower().startswith('y'):
self.delete_items()
self.make_catalogs()
answer = get_input(
'Are you sure? This action cannot be undone. [y/N] ')
if answer.lower().startswith('y'):
self.delete_items()
self.make_catalogs()
else:
print('Auto mode selected, deleting pkginfo and pkg items marked as [to be DELETED]')
self.delete_items()
self.make_catalogs()
def main():
@@ -439,6 +444,9 @@ def main():
parser.add_option('--plugin', default=pref('plugin'),
help='Optional plugin to connect to repo. If specified, '
'overrides any plugin specified via --configure.')
parser.add_option('--auto', '-a', action='store_true', default=False,
help='Do not prompt for confirmation before deleting repo items. '
'Use with caution.')
options, arguments = parser.parse_args()