aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@gentoo.org>2015-08-27 21:45:45 -0400
committerDevan Franchini <twitch153@gentoo.org>2015-08-27 21:47:15 -0400
commitd5ca0ce0d10220401176b981882349c9f25294c4 (patch)
treed0ecd1c7694ba16ab077f0878144bc283f057fcc /layman/maker.py
parentmaker.py: Adds multiple owner user query (diff)
downloadlayman-d5ca0ce0d10220401176b981882349c9f25294c4.tar.gz
layman-d5ca0ce0d10220401176b981882349c9f25294c4.tar.bz2
layman-d5ca0ce0d10220401176b981882349c9f25294c4.zip
maker.py: Modifies query prompts
These modifications remove a lot of duplicated prompts that were created when trying to prompt the user for an item that could be of more than one value.
Diffstat (limited to 'layman/maker.py')
-rw-r--r--layman/maker.py70
1 files changed, 27 insertions, 43 deletions
diff --git a/layman/maker.py b/layman/maker.py
index 06d624b..c184f6b 100644
--- a/layman/maker.py
+++ b/layman/maker.py
@@ -295,11 +295,11 @@ class Interactive(object):
feeds = []
for i in range(1, feed_amount + 1):
+ extra = ''
if feed_amount > 1:
- msg = 'Define overlay feed[%(i)s]: ' % ({'i': str(i)})
- feeds.append(get_input(msg))
- else:
- feeds.append(get_input('Define overlay feed: '))
+ extra = '[%(i)s]' % {'i': str(i)}
+ feeds.append(get_input('Define overlay%(extra)s feed: '\
+ % {'extra': extra}))
self.overlay['feed'] = feeds
self.output.notice('')
@@ -344,48 +344,32 @@ class Interactive(object):
for i in range(1, source_amount + 1):
sources = []
correct = False
+ extra = ''
if source_amount > 1:
- msg = 'Define source[%(i)s]\'s URL: ' % ({'i': str(i)})
- sources.append(get_input(msg))
+ extra = '[%(i)s]\'s' % {'i': str(i)}
- ovl_type = self.guess_overlay_type(sources[0])
- if ovl_type:
- msg = 'Is "%(type)s" the correct overlay type?: '\
- % ({'type': ovl_type})
- correct = get_ans(msg)
- while not ovl_type or not correct:
- msg = 'Please provide overlay type: '
- ovl_type = self.check_overlay_type(\
- get_input(msg, color='yellow'))
- correct = True
-
- sources.append(ovl_type)
- if 'branch' in self.required:
- msg = 'Define source[%(i)s]\'s branch (if applicable): '\
- % ({'i': str(i)})
- sources.append(get_input(msg))
- else:
- sources.append('')
+ msg = 'Define source%(extra)s URL: ' % {'extra': extra}
+ sources.append(get_input(msg))
+
+ ovl_type = self.guess_overlay_type(sources[0])
+ if ovl_type:
+ msg = 'Is "%(type)s" the correct overlay type?: '\
+ % ({'type': ovl_type})
+ correct = get_ans(msg)
+ while not ovl_type or not correct:
+ msg = 'Please provide overlay type: '
+ ovl_type = self.check_overlay_type(\
+ get_input(msg, color='yellow'))
+ correct = True
+
+ sources.append(ovl_type)
+ if 'branch' in self.required:
+ msg = 'Define source%(extra)s branch (if applicable): '\
+ % {'extra': extra}
+ sources.append(get_input(msg))
else:
- sources.append(get_input('Define source URL: '))
-
- ovl_type = self.guess_overlay_type(sources[0])
- if ovl_type:
- msg = 'Is %(type)s the correct overlay type?: '\
- % ({'type': ovl_type})
- correct = get_ans(msg)
- while not ovl_type or not correct:
- msg = 'Please provide overlay type: '
- ovl_type = self.check_overlay_type(\
- get_input(msg, color='yellow'))
- correct = True
-
- sources.append(ovl_type)
- if 'branch' in self.required:
- msg = 'Define source branch (if applicable): '
- sources.append(get_input(msg))
- else:
- sources.append('')
+ sources.append('')
+
if self.auto_complete:
sources = self._set_additional_info(sources)
for source in sources: