clint icon indicating copy to clipboard operation
clint copied to clipboard

Default on prompt.yn returns True always

Open ColdHeat opened this issue 7 years ago • 1 comments

https://github.com/kennethreitz/clint/blob/8c3cbe984bc3c966c60f279571a5a128d7c194ae/clint/textui/prompt.py#L48-L49

Shouldn't this take into account the default that's passed in?

With the following code if I just hit enter it will still delete the directory.

        if prompt.yn("Are you sure you want to delete {directory}".format(directory=directory), default='n'):
            print "Deleting..."
            shutil.rmtree(directory)
        else:
            print "Deletion aborted"

ColdHeat avatar Aug 20 '17 19:08 ColdHeat

You are right, modify default = 'n', for example, prompt.yn (xxx, default = 'n'), the returned value is still true

fcmxmk avatar May 11 '20 03:05 fcmxmk