Add a force option.

This commit is contained in:
Chris Johns 2012-10-30 02:40:18 +11:00
parent 19622ea2f5
commit 864360e67e

View File

@ -190,6 +190,7 @@ class command_line:
_defaults = { 'params' : [], _defaults = { 'params' : [],
'warn-all' : '0', 'warn-all' : '0',
'quiet' : '0', 'quiet' : '0',
'force' : '0',
'trace' : '0', 'trace' : '0',
'dry-run' : '0', 'dry-run' : '0',
'no-clean' : '0', 'no-clean' : '0',
@ -210,7 +211,8 @@ class command_line:
'--targetcxxflags' : '_targetcxxflags', '--targetcxxflags' : '_targetcxxflags',
'--libstdcxxflags' : '_libstdcxxflags' } '--libstdcxxflags' : '_libstdcxxflags' }
_long_true_opts = { '--trace' : '_trace', _long_true_opts = { '--force' : '_force',
'--trace' : '_trace',
'--dry-run' : '_dry_run', '--dry-run' : '_dry_run',
'--warn-all' : '_warn_all', '--warn-all' : '_warn_all',
'--no-clean' : '_no_clean', '--no-clean' : '_no_clean',
@ -224,6 +226,7 @@ class command_line:
def _help(self): def _help(self):
print '%s: [options] [args]' % (self.command_name) print '%s: [options] [args]' % (self.command_name)
print 'Options and arguments:' print 'Options and arguments:'
print '--force : Create directories that are not present'
print '--trace : Trace the execution (not current used)' print '--trace : Trace the execution (not current used)'
print '--dry-run : Do everything but actually run the build' print '--dry-run : Do everything but actually run the build'
print '--warn-all : Generate warnings' print '--warn-all : Generate warnings'
@ -360,7 +363,9 @@ class command_line:
if not lo: if not lo:
raise error.general('invalid argument: ' + a) raise error.general('invalid argument: ' + a)
else: else:
if a == '-n': if a == '-f':
self.opts['force'] = '1'
elif a == '-n':
self.opts['dry-run'] = '1' self.opts['dry-run'] = '1'
elif a == '-q': elif a == '-q':
self.opts['quiet'] = '1' self.opts['quiet'] = '1'
@ -395,6 +400,9 @@ class command_line:
def command(self): def command(self):
return os.path.join(self.command_path, self.command_name) return os.path.join(self.command_path, self.command_name)
def force(self):
return self.opts['force'] != '0'
def dry_run(self): def dry_run(self):
return self.opts['dry-run'] != '0' return self.opts['dry-run'] != '0'