summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-06-05 16:18:11 +0100
committerLars Wirzenius <liw@liw.fi>2011-06-05 16:18:11 +0100
commite9ae45153435205277fe7a43574ac11735d75909 (patch)
treece5d0a6d3728db285ff73e3bc94b465245f9be3a
parent8b3095fdfbc2338318ceeb7ce0acf6f1269d1fc1 (diff)
downloadunperish-e9ae45153435205277fe7a43574ac11735d75909.tar.gz
Run several subcommands from the command line.
-rwxr-xr-xunperish13
1 files changed, 10 insertions, 3 deletions
diff --git a/unperish b/unperish
index bd4fef4..a350ba6 100755
--- a/unperish
+++ b/unperish
@@ -64,7 +64,16 @@ class Unperish(cliapp.Application):
except IOError:
pass
- return cliapp.Application.process_args(self, args)
+ cmd_methods = self._subcommands()
+ for arg in args:
+ method = self._normalize_cmd(arg)
+ if method in cmd_methods:
+ if self.settings['verbose']:
+ self.output.write('command: %s\n' % arg)
+ if not self.settings['no-act']:
+ getattr(self, method)([])
+ else:
+ raise cliapp.AppException('unknown command %s' % arg)
@property
def upstream_name(self):
@@ -160,8 +169,6 @@ class Unperish(cliapp.Application):
logging.debug('runcmd: %s' % repr(argv))
if self.settings['verbose']:
self.output.write('run: %s\n' % ' '.join(argv))
- if self.settings['no-act']:
- return ''
p = subprocess.Popen(argv,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,