diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-06-05 16:18:11 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-06-05 16:18:11 +0100 |
commit | e9ae45153435205277fe7a43574ac11735d75909 (patch) | |
tree | ce5d0a6d3728db285ff73e3bc94b465245f9be3a /unperish | |
parent | 8b3095fdfbc2338318ceeb7ce0acf6f1269d1fc1 (diff) | |
download | unperish-e9ae45153435205277fe7a43574ac11735d75909.tar.gz |
Run several subcommands from the command line.
Diffstat (limited to 'unperish')
-rwxr-xr-x | unperish | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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, |