Abort informatively on unrecognized CLI options

rather than ignoring them, leading to unexpected behavior
This commit is contained in:
Min RK
2023-06-02 13:21:53 +02:00
parent 2ce263d45f
commit c930d6bf6a

View File

@@ -9,6 +9,7 @@ import logging
import os import os
import re import re
import secrets import secrets
import shlex
import signal import signal
import socket import socket
import ssl import ssl
@@ -2840,6 +2841,10 @@ class JupyterHub(Application):
super().initialize(*args, **kwargs) super().initialize(*args, **kwargs)
if self.generate_config or self.generate_certs or self.subapp: if self.generate_config or self.generate_certs or self.subapp:
return return
if self.extra_args:
self.exit(
f"Unrecognized command-line arguments: {' '.join(shlex.quote(arg) for arg in self.extra_args)!r}"
)
self._start_future = asyncio.Future() self._start_future = asyncio.Future()
def record_start(f): def record_start(f):