[Yum-devel] [PATCH] dnf: add defaultyes config option
Stefan Assmann
sassmann at redhat.com
Tue Jan 22 15:03:43 UTC 2013
Add a config option to change the default answer to "Yes".
So instead of
Is this ok [y/N]:
there will be
Is this ok [Y/n]:
This is not enabled by default and there's no intention to do so.
To enable this behaviour just add defaultyes=1 to dnf.conf.
---
dnf/cli/output.py | 9 ++++++++-
dnf/yum/config.py | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dnf/cli/output.py b/dnf/cli/output.py
index edfdea8..c78b264 100644
--- a/dnf/cli/output.py
+++ b/dnf/cli/output.py
@@ -965,15 +965,22 @@ class YumOutput:
aui = (yui[0], yui[1], nui[0], nui[1])
while True:
try:
- choice = dnf.i18n.input(_('Is this ok [y/N]: '))
+ if self.conf.defaultyes:
+ choice = dnf.i18n.input(_('Is this ok [Y/n]: '))
+ else:
+ choice = dnf.i18n.input(_('Is this ok [y/N]: '))
except UnicodeEncodeError:
raise
except UnicodeDecodeError:
raise
+ except KeyboardInterrupt:
+ choice = 'n'
except:
choice = ''
choice = to_unicode(choice)
choice = choice.lower()
+ if len(choice) == 0 and self.conf.defaultyes:
+ choice = 'y'
if len(choice) == 0 or choice in aui:
break
# If the enlish one letter names don't mix, allow them too
diff --git a/dnf/yum/config.py b/dnf/yum/config.py
index cad3a7e..f1fe5e9 100644
--- a/dnf/yum/config.py
+++ b/dnf/yum/config.py
@@ -732,6 +732,7 @@ class YumConf(StartupConf):
assumeyes = BoolOption(False)
assumeno = BoolOption(False)
+ defaultyes = BoolOption(False)
alwaysprompt = BoolOption(True)
exactarch = BoolOption(True)
diskspacecheck = BoolOption(True)
--
1.8.1
More information about the Yum-devel
mailing list