Run a simple default command line app, registering the specified account plugins.
(argv=None, account_plugins=None)
| 38 | |
| 39 | |
| 40 | def run_cmdline(argv=None, account_plugins=None): |
| 41 | """Run a simple default command line app, registering the specified |
| 42 | account plugins. |
| 43 | """ |
| 44 | import argparse |
| 45 | |
| 46 | if argv is None: |
| 47 | argv = sys.argv |
| 48 | |
| 49 | parser = argparse.ArgumentParser(prog=argv[0] if argv else None) |
| 50 | parser.add_argument("db", action="store", help="database file") |
| 51 | parser.add_argument("--show-ffi", action="store_true", help="show low level ffi events") |
| 52 | parser.add_argument("--email", action="store", help="email address") |
| 53 | parser.add_argument("--password", action="store", help="password") |
| 54 | |
| 55 | args = parser.parse_args(argv[1:]) |
| 56 | |
| 57 | ac = Account(args.db) |
| 58 | qr = ac.get_setup_contact_qr() |
| 59 | print(qr) |
| 60 | |
| 61 | ac.run_account(addr=args.email, password=args.password, account_plugins=account_plugins, show_ffi=args.show_ffi) |
| 62 | |
| 63 | addr = ac.get_config("addr") |
| 64 | print(f"{addr}: waiting for message") |
| 65 | |
| 66 | ac.wait_shutdown() |
no test coverage detected