Skip to content

Commit

Permalink
added a "list" command for pyobsd
Browse files Browse the repository at this point in the history
  • Loading branch information
thusser committed Dec 26, 2023
1 parent 0798a2e commit 7a4083d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyobs/cli/pyobsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 7a4083d

Please sign in to comment.