From 2c7a6dba37fef5c987545cca9d5d7814916081ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 11 Jul 2005 00:11:55 +0000 Subject: [PATCH] aptal bir confirm fonksiyonu ekle --- pisi/ui.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pisi/ui.py b/pisi/ui.py index 19933f61..a4cdfd68 100644 --- a/pisi/ui.py +++ b/pisi/ui.py @@ -27,6 +27,14 @@ class CLI: sys.stdout.write(colorize(msg, 'red')) sys.stdout.flush() + def confirm(self, msg): + while True: + s = raw_input(msg + colorize('(yes/no)', 'red')) + if s.starts_with('y') or s.starts_with('Y'): + return true + if s.starts_with('n') or s.starts_with('N'): + return false + class Progress: def __init__(self, totalsize): self.totalsize = totalsize