File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/labthings_fastapi/server Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1010from . import ThingServer , server_from_config
1111
1212
13- def parse_args (argv : Optional [list [str ]] = None ) -> Namespace :
14- """Process command line arguments for the server"""
13+ def get_default_parser ():
14+ """Return the default CLI parser for LabThings
15+
16+ This can be used instead of `parse_args` if more arguments are needed
17+ """
18+
1519 parser = ArgumentParser ()
1620 parser .add_argument ("-c" , "--config" , type = str , help = "Path to configuration file" )
1721 parser .add_argument ("-j" , "--json" , type = str , help = "Configuration as JSON string" )
@@ -29,8 +33,14 @@ def parse_args(argv: Optional[list[str]] = None) -> Namespace:
2933 default = 5000 ,
3034 help = "Bind socket to this port. If 0, an available port will be picked." ,
3135 )
32- args = parser .parse_args (argv )
33- return args
36+ return parser
37+
38+
39+ def parse_args (argv : Optional [list [str ]] = None ) -> Namespace :
40+ """Process command line arguments for the server"""
41+ parser = get_default_parser ()
42+ # Use parser to parse CLI arguments and return the namespace with attributes set.
43+ return parser .parse_args (argv )
3444
3545
3646def config_from_args (args : Namespace ) -> dict :
You can’t perform that action at this time.
0 commit comments