7016: new cmdline switches -y/--yes and -q/--quiet

Add to -h output new text about -y and -q

impex.sh switched to use --yes and --quiet

Refactor ArgHandler to reuse User object

ArgHandler now uses user.prompt
No longer custom code duplicating user.prompt functionality

This dropped support for English yes/no and prefixes in the
"OK to overwrite?", as User.prompt allows pressing "Enter"
to accept by default, and everything else except
verbatim accept choice will be treated as reject.

cli.user.User.prompt now supports treating EOF as a reject

prompt message reformatted: added newline after title

Previously, code
	'-q' in ('--qml')
returned True, which was not what ArgParser meant.
Changed the rhs of in to [] from () to avoid this for every case
in ArgParser.parse in the future as well.

Tests run: the new UT added and impex.sh

svn: r22916
This commit is contained in:
Vassilii Khachaturov
2013-08-28 09:24:26 +00:00
parent 1bb6398717
commit 62854bb089
8 changed files with 200 additions and 53 deletions

View File

@ -69,10 +69,13 @@ class User():
else:
self.callback_function(percentage)
else:
if text is None:
self._fileout.write("\r%02d%%" % percentage)
else:
self._fileout.write("\r%02d%% %s" % (percentage, text))
self._default_callback(percentage, text)
def _default_callback(self, percentage, text):
if text is None:
self._fileout.write("\r%02d%%" % percentage)
else:
self._fileout.write("\r%02d%% %s" % (percentage, text))
def end_progress(self):
"""