diff options
Diffstat (limited to 'command.py')
| -rw-r--r-- | command.py | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -98,6 +98,16 @@ class Command(object): | |||
| 98 | self.OptionParser.print_usage() | 98 | self.OptionParser.print_usage() |
| 99 | sys.exit(1) | 99 | sys.exit(1) |
| 100 | 100 | ||
| 101 | def ValidateOptions(self, opt, args): | ||
| 102 | """Validate the user options & arguments before executing. | ||
| 103 | |||
| 104 | This is meant to help break the code up into logical steps. Some tips: | ||
| 105 | * Use self.OptionParser.error to display CLI related errors. | ||
| 106 | * Adjust opt member defaults as makes sense. | ||
| 107 | * Adjust the args list, but do so inplace so the caller sees updates. | ||
| 108 | * Try to avoid updating self state. Leave that to Execute. | ||
| 109 | """ | ||
| 110 | |||
| 101 | def Execute(self, opt, args): | 111 | def Execute(self, opt, args): |
| 102 | """Perform the action, after option parsing is complete. | 112 | """Perform the action, after option parsing is complete. |
| 103 | """ | 113 | """ |
