| Total Complexity | 3 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 81.25% |
| Changes | 0 | ||
| 1 | """kytos - The kytos command line. |
||
| 2 | |||
| 3 | You are at the "users" command. |
||
| 4 | |||
| 5 | Usage: |
||
| 6 | kytos users register |
||
| 7 | kytos users -h | --help |
||
| 8 | |||
| 9 | Options: |
||
| 10 | |||
| 11 | -h, --help Show this screen. |
||
| 12 | |||
| 13 | Common user subcommands: |
||
| 14 | |||
| 15 | register Register a new user to upload napps to Napps Server. |
||
| 16 | |||
| 17 | """ |
||
| 18 | 1 | import sys |
|
| 19 | |||
| 20 | 1 | from docopt import docopt |
|
| 21 | |||
| 22 | 1 | from kytos.cli.commands.users.api import UsersAPI |
|
| 23 | 1 | from kytos.utils.config import KytosConfig |
|
| 24 | 1 | from kytos.utils.exceptions import KytosException |
|
| 25 | |||
| 26 | |||
| 27 | 1 | def parse(argv): |
|
| 28 | """Parse cli args.""" |
||
| 29 | 1 | args = docopt(__doc__, argv=argv) |
|
| 30 | 1 | try: |
|
| 31 | 1 | call(sys.argv[2], args) |
|
| 32 | except KytosException as exception: |
||
| 33 | print("Error parsing args: {}".format(exception)) |
||
| 34 | sys.exit() |
||
| 35 | |||
| 36 | |||
| 37 | 1 | def call(subcommand, args): |
|
| 38 | """Call a subcommand passing the args.""" |
||
| 39 | 1 | KytosConfig.check_versions() |
|
| 40 | 1 | func = getattr(UsersAPI, subcommand) |
|
| 41 | func(args) |
||
| 42 |