Parse a command line string. Divides the string in three blocks: general_options, command name, and command options+arguments
(self, argv)
| 27 | self._argv_consumed_params['CMD_OPT'] = [] |
| 28 | |
| 29 | def parse(self, argv): |
| 30 | """Parse a command line string. |
| 31 | Divides the string in three blocks: general_options, |
| 32 | command name, and command options+arguments |
| 33 | """ |
| 34 | step = 1 |
| 35 | for arg in argv[1:]: |
| 36 | if not arg: |
| 37 | continue |
| 38 | |
| 39 | if step == 1: |
| 40 | if arg[0] in string.ascii_letters: |
| 41 | self._argv_split['CMD'] = arg |
| 42 | step = 2 |
| 43 | else: |
| 44 | self._argv_split['GEN_OPT'].append(arg) |
| 45 | elif step == 2: |
| 46 | self._argv_split['CMD_OPT'].append(arg) |
| 47 | |
| 48 | return step == 2 |
| 49 | |
| 50 | def missing_options(self): |
| 51 | """Get command line options not used/fetched by Cmdp.get() |