add --list/--list-all CLI flags

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Vlad Doloman
2026-07-08 16:22:22 +03:00
parent 3c4eef6bb0
commit 6248ff47b8
2 changed files with 45 additions and 0 deletions

View File

@@ -1410,6 +1410,10 @@ def _build_parser() -> argparse.ArgumentParser:
group.add_argument("--reissue", metavar="CN", help="Revoke and reissue certificate for CN")
group.add_argument("--revoke", metavar="CN", help="Revoke certificate for CN and regenerate CRL")
group.add_argument("--gen-crl", action="store_true", help="Regenerate and copy CRL")
group.add_argument("--list", action="store_true",
help="List recently-expired/soon-to-expire CNs "
"(per DAYS_PAST/DAYS_AHEAD) with email")
group.add_argument("--list-all", action="store_true", help="List all CNs with email")
parser.add_argument("--email", metavar="EMAIL",
help="Email address (required for --create; optional for --reissue)")
parser.add_argument("--send-email", dest="send_email", action="store_const", const=True,
@@ -1441,6 +1445,13 @@ def main() -> None:
sys.exit(1)
globals().update(overrides)
if args.list:
CliRunner().list_certs(show_all=False)
return
if args.list_all:
CliRunner().list_certs(show_all=True)
return
global CA_PASSPHRASE
CA_PASSPHRASE = resolve_ca_passphrase(CA_PASSPHRASE, EASYRSA_PKI_DIR)