From: Mike Bayer Date: Tue, 20 May 2025 19:56:12 +0000 (-0400) Subject: fix list_templates command X-Git-Tag: rel_1_16_0~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=452b59728fde58e7f6fa869c6a689c1fe81f04d4;p=thirdparty%2Fsqlalchemy%2Falembic.git fix list_templates command in switching this to use pathlib, the template names were coming out as long absolute paths Change-Id: I3ba7de601a11fbd28e96c63e7bdcfd4accdfd858 --- diff --git a/alembic/command.py b/alembic/command.py index 9b1a44cb..4ae3f9ef 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -31,11 +31,9 @@ def list_templates(config: Config) -> None: config.print_stdout("Available templates:\n") for tempname in config._get_template_path().iterdir(): - with ( - config._get_template_path() / tempname / "README" - ).open() as readme: + with (tempname / "README").open() as readme: synopsis = next(readme).rstrip() - config.print_stdout("%s - %s", tempname, synopsis) + config.print_stdout("%s - %s", tempname.name, synopsis) config.print_stdout("\nTemplates are used via the 'init' command, e.g.:") config.print_stdout("\n alembic init --template generic ./scripts")