Skip to content

Commit

Permalink
Change 'osc wipe' command to use the new get_user_input() function.
Browse files Browse the repository at this point in the history
Example:
>>> Really wipe '/var/tmp/build-root/openSUSE_Tumbleweed-x86_64'? [y/N]:
changed to:
>>> Really wipe '/var/tmp/build-root/openSUSE_Tumbleweed-x86_64'?
>>> y)yes / n)no (default=n):
  • Loading branch information
dmach committed Feb 8, 2024
1 parent 52d014d commit 6688ffd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from .core import *
from .grabber import OscFileGrabber
from .meter import create_text_meter
from .output import get_user_input
from .util import cpio, rpmquery, safewriter
from .util.helper import _html_escape, format_table

Expand Down Expand Up @@ -7307,11 +7308,13 @@ def do_build(self, subcmd, opts, *args):
build_root = osc_build.calculate_build_root(apihost, prj, pac, repo, arch, user)
if opts.wipe and not opts.force:
# Confirm delete
print(f"Really wipe '{build_root}'? [y/N]: ", end="")
choice = raw_input().lower()
if choice != 'y':
print('Aborting')
sys.exit(0)
reply = get_user_input(

Check warning on line 7311 in osc/commandline.py

View check run for this annotation

Codecov / codecov/patch

osc/commandline.py#L7311

Added line #L7311 was not covered by tests
f"Really wipe '{build_root}'?",
answers={"y": "yes", "n": "no"},
default_answer="n",
)
if reply != "y":
raise oscerr.UserAbort()

Check warning on line 7317 in osc/commandline.py

View check run for this annotation

Codecov / codecov/patch

osc/commandline.py#L7316-L7317

Added lines #L7316 - L7317 were not covered by tests
build_args = ['--root=' + build_root, '--noinit', '--shell']
if opts.wipe:
build_args.append('--wipe')
Expand Down

0 comments on commit 6688ffd

Please sign in to comment.