From e9ae45153435205277fe7a43574ac11735d75909 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 5 Jun 2011 16:18:11 +0100 Subject: Run several subcommands from the command line. --- unperish | 13 ++++++++++--- 1 file 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, -- cgit v1.2.1