Merge lp:~jtv/maas/maascli-extract-parser into lp:maas/trunk
Proposed by
Jeroen T. Vermeulen
on 2012-10-08
| Status: | Merged |
|---|---|
| Approved by: | Jeroen T. Vermeulen on 2012-10-08 |
| Approved revision: | 1224 |
| Merged at revision: | 1223 |
| Proposed branch: | lp:~jtv/maas/maascli-extract-parser |
| Merge into: | lp:maas/trunk |
| Diff against target: |
226 lines (+110/-47) 5 files modified
src/maascli/__init__.py (+2/-38) src/maascli/parser.py (+72/-0) src/maascli/tests/test_api.py (+2/-4) src/maascli/tests/test_cli.py (+2/-4) src/maascli/tests/test_parser.py (+32/-1) |
| To merge this branch: | bzr merge lp:~jtv/maas/maascli-extract-parser |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Gavin Panella (community) | 2012-10-08 | Approve on 2012-10-08 | |
|
Review via email:
|
|||
Commit Message
Extract the arguments-parsing part of maascli into its own module.
Description of the Change
This was bloating the diff for my user-interface changes to maascli. In follow-up branches, the parser will learn a new --profile option; register API functions directly into its main namespace; and move the CLI management commands down into a new "cli" namespace.
Jeroen
To post a comment you must log in.
| Jeroen T. Vermeulen (jtv) wrote : | # |
Yes, I'll probably want to get more cleverer about keeping the profile option. Haven't quite got that finalized yet, although I have a working prototype.
I fixed the __import__.
lp:~jtv/maas/maascli-extract-parser
updated
on 2012-10-08
- 1224. By Jeroen T. Vermeulen on 2012-10-08
-
Review suggestion: no need for __import__.


Looks good.
[1]
+def get_profile_ option( argv): add_help= False) parser. add_argument( '--profile' , metavar='PROFILE') options = specialized_ parser. parse_known_ args(argv) [0] options. profile
...
+ specialized_parser = ArgumentParser(
+ specialized_
+ provisional_
+ return provisional_
This throws away the left-over args. I suspect you might want them
later on, otherwise you'll need to allow for parsing the --profile
option again.
[2]
+ module = __import_ _('maascli. api', fromlist=True)
This is a hang-over from ye olden days; you can probably just import
the module.