From 7a4083dec4db4e37491e49e24a6cc5cc7dd75cbd Mon Sep 17 00:00:00 2001 From: Tim-Oliver Husser Date: Tue, 26 Dec 2023 16:49:58 +0100 Subject: [PATCH] added a "list" command for pyobsd --- pyobs/cli/pyobsd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyobs/cli/pyobsd.py b/pyobs/cli/pyobsd.py index 70f708a4..277288df 100755 --- a/pyobs/cli/pyobsd.py +++ b/pyobs/cli/pyobsd.py @@ -135,6 +135,10 @@ def status(self, services: Optional[List[str]] = None) -> None: for p in services: print(("[X]" if p in configs else "[ ]") + " " + ("[X]" if p in running else "[ ]") + " " + p) + def list(self, **kwargs) -> None: + configs = [self._service(r) for r in self._configs] + print("\n".join(configs)) + def _start_service(self, service: str) -> None: # get PID file pid_file = self._pid_file(service) @@ -228,7 +232,7 @@ def main() -> None: parser.add_argument( "--start-stop-daemon", type=str, default=config.get("start-stop-daemon", "/sbin/start-stop-daemon") ) - parser.add_argument("command", type=str, choices=["start", "stop", "restart", "status"]) + parser.add_argument("command", type=str, choices=["start", "stop", "restart", "status", "list"]) parser.add_argument("services", type=str, nargs="*") args = parser.parse_args()