]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
fix list_templates command
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 May 2025 19:56:12 +0000 (15:56 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 May 2025 19:56:12 +0000 (15:56 -0400)
in switching this to use pathlib, the template names were coming out
as long absolute paths

Change-Id: I3ba7de601a11fbd28e96c63e7bdcfd4accdfd858

alembic/command.py

index 9b1a44cb9891c16da8cde0d3897ce837f78b74b1..4ae3f9ef770ddb53e55025b55e2da06761a1bd26 100644 (file)
@@ -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")