Coverage for gws-app/gws/server/cli.py: 0%
36 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 22:59 +0200
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 22:59 +0200
1"""Command-line server commands."""
3from typing import Optional
5import gws
7from . import control
10class Params(gws.CliParams):
11 """Parameters for server commands."""
12 config: Optional[str]
13 """Configuration file."""
14 manifest: Optional[str]
15 """Manifest file."""
18class ConfigTestParams(gws.CliParams):
19 """Parameters for the config test command."""
20 config: Optional[str]
21 """Configuration file."""
22 manifest: Optional[str]
23 """Manifest file."""
24 dirs: Optional[str]
25 """Directories to watch for changes."""
26 watch: Optional[bool]
27 """Watch mode."""
28 parse: Optional[bool]
29 """Only parse the config."""
32gws.ext.new.cli('server')
35class Object(gws.Node):
36 """Server command-line interface object."""
38 @gws.ext.command.cli('serverStart')
39 def do_start(self, p: Params):
40 """Configure and start the server."""
42 control.start(p.manifest, p.config)
44 @gws.ext.command.cli('serverReload')
45 def do_reload(self, p: Params):
46 """Restart the server."""
48 control.reload_all()
50 @gws.ext.command.cli('serverReconfigure')
51 def do_reconfigure(self, p: Params):
52 """Reconfigure and restart the server."""
54 control.reconfigure(p.manifest, p.config)
56 @gws.ext.command.cli('serverConfigure')
57 def do_configure(self, p: Params):
58 """Configure the server, but do not restart."""
60 control.configure_and_store(p.manifest, p.config)
62 @gws.ext.command.cli('serverConfigtest')
63 def do_configtest(self, p: ConfigTestParams):
64 """Test the configuration."""
66 control.config_test(
67 p.manifest,
68 p.config,
69 p.dirs,
70 with_parse_only=p.parse,
71 with_watch=p.watch,
72 )