diff options
Diffstat (limited to 'command.py')
| -rw-r--r-- | command.py | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -16,11 +16,11 @@ import multiprocessing | |||
| 16 | import os | 16 | import os |
| 17 | import optparse | 17 | import optparse |
| 18 | import re | 18 | import re |
| 19 | import sys | ||
| 20 | 19 | ||
| 21 | from event_log import EventLog | 20 | from event_log import EventLog |
| 22 | from error import NoSuchProjectError | 21 | from error import NoSuchProjectError |
| 23 | from error import InvalidProjectGroupsError | 22 | from error import InvalidProjectGroupsError |
| 23 | from error import RepoExitError | ||
| 24 | import progress | 24 | import progress |
| 25 | 25 | ||
| 26 | 26 | ||
| @@ -42,6 +42,10 @@ WORKER_BATCH_SIZE = 32 | |||
| 42 | DEFAULT_LOCAL_JOBS = min(os.cpu_count(), 8) | 42 | DEFAULT_LOCAL_JOBS = min(os.cpu_count(), 8) |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | class UsageError(RepoExitError): | ||
| 46 | """Exception thrown with invalid command usage.""" | ||
| 47 | |||
| 48 | |||
| 45 | class Command(object): | 49 | class Command(object): |
| 46 | """Base class for any command line action in repo.""" | 50 | """Base class for any command line action in repo.""" |
| 47 | 51 | ||
| @@ -215,7 +219,7 @@ class Command(object): | |||
| 215 | def Usage(self): | 219 | def Usage(self): |
| 216 | """Display usage and terminate.""" | 220 | """Display usage and terminate.""" |
| 217 | self.OptionParser.print_usage() | 221 | self.OptionParser.print_usage() |
| 218 | sys.exit(1) | 222 | raise UsageError() |
| 219 | 223 | ||
| 220 | def CommonValidateOptions(self, opt, args): | 224 | def CommonValidateOptions(self, opt, args): |
| 221 | """Validate common options.""" | 225 | """Validate common options.""" |
