Skip to content

Commit f72359c

Browse files
committed
Hide daemon command on Windows and update docs
1 parent c85ec0f commit f72359c

4 files changed

Lines changed: 37 additions & 5 deletions

File tree

docs/commands.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,12 @@ by a system scheduler (launchd on macOS, systemd on Linux). Each run
493493
executes exactly one cycle: ``updatedb`` always, and optionally fetch event
494494
details and/or waveform data depending on the configuration.
495495

496+
.. note::
497+
498+
The ``daemon`` command is available only on macOS and Linux.
499+
On Windows, daemon mode is not supported and the ``daemon`` command does
500+
not appear in the CLI.
501+
496502
seiscat daemon run
497503
^^^^^^^^^^^^^^^^^^
498504

docs/getting_started.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ system's native scheduler: **launchd** on macOS and **systemd** on Linux.
129129
Each scheduled invocation runs exactly one cycle (``updatedb``, plus
130130
optional fetch stages) and then exits.
131131

132+
.. note::
133+
134+
Daemon mode is currently supported only on macOS and Linux.
135+
On Windows, the ``daemon`` command is not available and will not appear
136+
in ``seiscat --help``.
137+
132138
1. **Enable daemon mode** in your ``seiscat.conf``:
133139

134140
.. code-block::
@@ -193,9 +199,8 @@ presence, and the OS service status.
193199

194200
**Windows**
195201

196-
Native Windows service support (Task Scheduler) is not yet implemented.
197-
On Windows, you can run ``seiscat daemon run`` manually or via a scheduled
198-
task configured through the Task Scheduler GUI.
202+
Windows daemon integration is not currently implemented.
203+
The ``seiscat daemon`` command tree is hidden on Windows.
199204

200205

201206
Next

seiscat/config/parse_arguments.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import sys
1414
import textwrap
1515
import argparse
16+
import platform
1617
import argcomplete
1718
from rich_argparse import RichHelpFormatter
1819
from rich.console import Console
@@ -806,7 +807,7 @@ def _add_daemon_parser(subparser, parents):
806807
'daemon',
807808
parents=[parents['configfile_parser']],
808809
formatter_class=RichHelpFormatter,
809-
help='manage the seiscat scheduled daemon (launchd/systemd)'
810+
help='manage the seiscat scheduled daemon'
810811
)
811812
daemon_subparser = daemon_parser.add_subparsers(
812813
dest='daemon_action',
@@ -990,7 +991,8 @@ def parse_arguments():
990991
_add_set_parser(subparser, parents)
991992
_add_fetchdata_parser(subparser, parents)
992993
_add_run_parser(subparser, parents)
993-
_add_daemon_parser(subparser, parents)
994+
if platform.system().lower() != 'windows':
995+
_add_daemon_parser(subparser, parents)
994996
_add_sampleconfig_parser(subparser)
995997
_add_samplescript_parser(subparser)
996998
_add_self_parser(subparser)

tests/test_daemon_parse.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ def test_daemon_without_subcommand_shows_help(self):
7272
parse_arguments()
7373
self.assertEqual(cm.exception.code, 0)
7474

75+
@patch('seiscat.config.parse_arguments.platform.system',
76+
return_value='Windows')
77+
@patch('sys.argv', ['seiscat', '--help'])
78+
def test_daemon_not_shown_in_help_on_windows(self, _mock_platform):
79+
with patch('sys.stdout') as mock_stdout:
80+
with self.assertRaises(SystemExit):
81+
parse_arguments()
82+
printed = ''.join(
83+
call.args[0] for call in mock_stdout.write.call_args_list)
84+
self.assertNotIn('daemon', printed)
85+
86+
@patch('seiscat.config.parse_arguments.platform.system',
87+
return_value='Windows')
88+
@patch('sys.argv', ['seiscat', 'daemon', 'status'])
89+
def test_daemon_command_unavailable_on_windows(self, _mock_platform):
90+
with self.assertRaises(SystemExit) as cm:
91+
parse_arguments()
92+
self.assertEqual(cm.exception.code, 2)
93+
7594

7695
if __name__ == '__main__':
7796
unittest.main()

0 commit comments

Comments
 (0)