From 1a72e1e087fe982f5ec95116f9e06648762fe553 Mon Sep 17 00:00:00 2001 From: Muayyad alsadi Date: Mon, 14 Mar 2022 14:05:20 +0300 Subject: [PATCH] add systemd -a list --- podman_compose.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/podman_compose.py b/podman_compose.py index 6d7ba9b..8bb0866 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -16,6 +16,7 @@ import re import hashlib import random import json +import glob from threading import Thread @@ -1726,6 +1727,10 @@ def compose_systemd(compose, args): f"""later you can use use enable, start, stop, status, cat like this `systemctl --user enable --now podman-compose@{proj_name}`""" ) + elif args.action == "list" or args.action == "ls": + ls = glob.glob(os.path.expanduser(f"~/{stacks_dir}/*.env")) + for i in ls: + print(os.path.basename(i[:-4])) elif args.action == "create-unit": script = os.path.realpath(sys.argv[0]) fn = "/usr/lib/systemd/user/podman-compose@.service" @@ -2512,7 +2517,7 @@ def compose_systemd_parse(parser): parser.add_argument( "-a", "--action", - choices=["register", "create-unit"], + choices=["register", "create-unit", "list", "ls"], default="register", help="create systemd unit file or register compose stack to it", )