(parts)
| 483 | |
| 484 | # Given an array of parts, parse commands and arguments |
| 485 | def parse_cmd(parts): |
| 486 | parser = None |
| 487 | if parts[0] == "acc": |
| 488 | parser = argparse.ArgumentParser(prog=parts[0], description='Create or alter an account') |
| 489 | parser.add_argument('--user', default='new', help='ID of the account to update') |
| 490 | parser.add_argument('--scheme', default=None, help='authentication scheme, default=basic') |
| 491 | parser.add_argument('--secret', default=None, help='secret for authentication') |
| 492 | parser.add_argument('--uname', default=None, help='user name for basic authentication') |
| 493 | parser.add_argument('--password', default=None, help='password for basic authentication') |
| 494 | parser.add_argument('--do-login', action='store_true', help='login with the newly created account') |
| 495 | parser.add_argument('--tags', action=None, help='tags for user discovery, comma separated list without spaces') |
| 496 | parser.add_argument('--fn', default=None, help='user\'s human name') |
| 497 | parser.add_argument('--photo', default=None, help='avatar file name') |
| 498 | parser.add_argument('--private', default=None, help='user\'s private info') |
| 499 | parser.add_argument('--note', default=None, help='user\'s description') |
| 500 | parser.add_argument('--trusted', default=None, help='trusted markers: verified, staff, danger, prepend with rm- to remove, e.g. rm-verified') |
| 501 | parser.add_argument('--auth', default=None, help='default access mode for authenticated users') |
| 502 | parser.add_argument('--anon', default=None, help='default access mode for anonymous users') |
| 503 | parser.add_argument('--cred', default=None, help='credentials, comma separated list in method:value format, e.g. email:test@example.com,tel:12345') |
| 504 | parser.add_argument('--suspend', default=None, help='true to suspend the account, false to un-suspend') |
| 505 | elif parts[0] == "del": |
| 506 | parser = argparse.ArgumentParser(prog=parts[0], description='Delete message(s), subscription, topic, user') |
| 507 | parser.add_argument('what', default=None, help='what to delete') |
| 508 | parser.add_argument('--topic', default=None, help='topic being affected') |
| 509 | parser.add_argument('--user', default=None, help='either delete this user or a subscription with this user') |
| 510 | parser.add_argument('--seq', default=None, help='"all" or a list of comma- and dash-separated message IDs to delete, e.g. "1,2,9-12"') |
| 511 | parser.add_argument('--hard', action='store_true', help='request to hard-delete') |
| 512 | parser.add_argument('--cred', help='credential to delete in method:value format, e.g. email:test@example.com, tel:12345') |
| 513 | elif parts[0] == "file": |
| 514 | parser = argparse.ArgumentParser(prog=parts[0], description='Download or upload a large file') |
| 515 | parser.add_argument('--what', default='down', choices=['down', 'up'], help='download \'down\' or upload \'up\'') |
| 516 | parser.add_argument('filename', help='name of the file to upload') |
| 517 | elif parts[0] == "get": |
| 518 | parser = argparse.ArgumentParser(prog=parts[0], description='Query topic for messages or metadata') |
| 519 | parser.add_argument('topic', nargs='?', default=argparse.SUPPRESS, help='topic to query') |
| 520 | parser.add_argument('--topic', dest='topic', default=None, help='topic to query') |
| 521 | parser.add_argument('--desc', action='store_true', help='query topic description') |
| 522 | parser.add_argument('--sub', action='store_true', help='query topic subscriptions') |
| 523 | parser.add_argument('--tags', action='store_true', help='query topic tags') |
| 524 | parser.add_argument('--data', action='store_true', help='query topic messages') |
| 525 | parser.add_argument('--cred', action='store_true', help='query account credentials') |
| 526 | elif parts[0] == "leave": |
| 527 | parser = argparse.ArgumentParser(prog=parts[0], description='Detach or unsubscribe from topic') |
| 528 | parser.add_argument('topic', nargs='?', default=argparse.SUPPRESS, help='topic to detach from') |
| 529 | parser.add_argument('--topic', dest='topic', default=None, help='topic to detach from') |
| 530 | parser.add_argument('--unsub', action='store_true', help='detach and unsubscribe from topic') |
| 531 | elif parts[0] == "login": |
| 532 | parser = argparse.ArgumentParser(prog=parts[0], description='Authenticate current session') |
| 533 | parser.add_argument('secret', nargs='?', default=argparse.SUPPRESS, help='secret for authentication') |
| 534 | parser.add_argument('--scheme', default='basic', help='authentication schema, default=basic') |
| 535 | parser.add_argument('--secret', dest='secret', default=None, help='secret for authentication') |
| 536 | parser.add_argument('--uname', default=None, help='user name in basic authentication scheme') |
| 537 | parser.add_argument('--password', default=None, help='password in basic authentication scheme') |
| 538 | parser.add_argument('--cred', default=None, help='credentials, comma separated list in method:value:response format, e.g. email:test@example.com,tel:12345') |
| 539 | elif parts[0] == "note": |
| 540 | parser = argparse.ArgumentParser(prog=parts[0], description='Send notification to topic, ex "note kp"') |
| 541 | parser.add_argument('topic', help='topic to notify') |
| 542 | parser.add_argument('what', nargs='?', default='kp', const='kp', choices=['call', 'kp', 'read', 'recv'], |
no outgoing calls
no test coverage detected
searching dependent graphs…