|
6 | 6 | __author__ = 'Simon Robinson' |
7 | 7 | __copyright__ = 'Copyright (c) 2022 Simon Robinson' |
8 | 8 | __license__ = 'Apache 2.0' |
9 | | -__version__ = '2023-03-09' # ISO 8601 (YYYY-MM-DD) |
| 9 | +__version__ = '2023-03-15' # ISO 8601 (YYYY-MM-DD) |
10 | 10 |
|
11 | 11 | import abc |
12 | 12 | import argparse |
@@ -2105,34 +2105,41 @@ class App: |
2105 | 2105 |
|
2106 | 2106 | def __init__(self): |
2107 | 2107 | global CONFIG_FILE_PATH, CACHE_STORE |
2108 | | - parser = argparse.ArgumentParser(description=APP_NAME) |
2109 | | - parser.add_argument('--no-gui', action='store_true', help='start the proxy without a menu bar icon (note: ' |
2110 | | - 'account authorisation requests will fail unless a ' |
2111 | | - 'pre-authorised configuration file is used, or you ' |
2112 | | - 'enable `--external-auth` or `--local-server-auth` ' |
2113 | | - 'and monitor log/terminal output)') |
2114 | | - parser.add_argument('--external-auth', action='store_true', help='handle authorisation externally: rather than ' |
2115 | | - 'intercepting `redirect_uri`, the proxy will ' |
2116 | | - 'wait for you to paste the result into either ' |
2117 | | - 'its popup window (GUI-mode) or the terminal ' |
2118 | | - '(no-GUI mode; requires `prompt_toolkit`)') |
2119 | | - parser.add_argument('--local-server-auth', action='store_true', help='handle authorisation by printing request ' |
2120 | | - 'URLs to the log and starting a local web ' |
2121 | | - 'server on demand to receive responses') |
2122 | | - parser.add_argument('--config-file', default=None, help='the full path to the proxy\'s configuration file ' |
2123 | | - '(optional; default: `%s` in the same directory as the ' |
2124 | | - 'proxy script)' % os.path.basename(CONFIG_FILE_PATH)) |
2125 | | - parser.add_argument('--cache-store', default=None, help='the full path to a local file to use for credential' |
2126 | | - 'caching (optional; default: save to `--config-file`); ' |
2127 | | - 'alternatively, an external store such as a secrets ' |
2128 | | - 'manager can be used - see the proxy\'s readme for ' |
2129 | | - 'instructions and requirements') |
2130 | | - parser.add_argument('--log-file', default=None, help='the full path to a file where log output should be sent ' |
2131 | | - '(optional; default behaviour varies by platform, but see ' |
2132 | | - 'Log.initialise() for details of each implementation)') |
2133 | | - parser.add_argument('--debug', action='store_true', help='enable debug mode, printing client<->proxy<->server ' |
2134 | | - 'interaction to the system log') |
2135 | | - parser.add_argument('--version', action='version', version='%s %s' % (APP_NAME, __version__)) |
| 2108 | + parser = argparse.ArgumentParser(description='%s: transparently add OAuth 2.0 support to IMAP/POP/SMTP client ' |
| 2109 | + 'applications, scripts or any other email use-cases that don\'t ' |
| 2110 | + 'support this authentication method.' % APP_NAME, add_help=False, |
| 2111 | + epilog='Full readme and guide: https://github.com/simonrob/email-oauth2-proxy') |
| 2112 | + group_gui = parser.add_argument_group(title='appearance') |
| 2113 | + group_gui.add_argument('--no-gui', action='store_true', |
| 2114 | + help='start the proxy without a menu bar icon (note: account authorisation requests ' |
| 2115 | + 'will fail unless a pre-authorised `--config-file` is used, or you use ' |
| 2116 | + '`--external-auth` or `--local-server-auth` and monitor log/terminal output)') |
| 2117 | + group_auth = parser.add_argument_group('authentication methods') |
| 2118 | + group_auth.add_argument('--external-auth', action='store_true', |
| 2119 | + help='handle authorisation externally: rather than intercepting `redirect_uri`, the ' |
| 2120 | + 'proxy will wait for you to paste the result into either its popup window (GUI ' |
| 2121 | + 'mode) or the terminal (no-GUI mode; requires `prompt_toolkit`)') |
| 2122 | + group_auth.add_argument('--local-server-auth', action='store_true', |
| 2123 | + help='handle authorisation by printing request URLs to the log and starting a local ' |
| 2124 | + 'web server on demand to receive responses') |
| 2125 | + group_config = parser.add_argument_group('server, account and runtime configuration') |
| 2126 | + group_config.add_argument('--config-file', default=None, |
| 2127 | + help='the full path to the proxy\'s configuration file (optional; default: `%s` in ' |
| 2128 | + 'the same directory as the proxy script)' % os.path.basename(CONFIG_FILE_PATH)) |
| 2129 | + group_config.add_argument('--cache-store', default=None, |
| 2130 | + help='the full path to a local file to use for credential caching (optional; ' |
| 2131 | + 'default: save to `--config-file`); alternatively, an external store such as a ' |
| 2132 | + 'secrets manager can be used - see readme for instructions and requirements') |
| 2133 | + group_debug = parser.add_argument_group('logging, debugging and help') |
| 2134 | + group_debug.add_argument('--log-file', default=None, |
| 2135 | + help='the full path to a file where log output should be sent (optional; default log ' |
| 2136 | + 'behaviour varies by platform - see readme for details)') |
| 2137 | + group_debug.add_argument('--debug', action='store_true', |
| 2138 | + help='enable debug mode, sending all client<->proxy<->server communication to the ' |
| 2139 | + 'proxy\'s log') |
| 2140 | + group_debug.add_argument('--version', action='version', version='%s %s' % (APP_NAME, __version__), |
| 2141 | + help='show the proxy\'s version string and exit') |
| 2142 | + group_debug.add_argument('-h', '--help', action='help', help='show this help message and exit') |
2136 | 2143 |
|
2137 | 2144 | self.args = parser.parse_args() |
2138 | 2145 |
|
|
0 commit comments