From 53848f1137e26d0c110bfc1aa879d39fb6cc2e1f Mon Sep 17 00:00:00 2001 From: bswck Date: Tue, 6 Aug 2024 19:17:14 +0200 Subject: [PATCH] Accept `Repo` as a CLI argument --- __main__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/__main__.py b/__main__.py index 5981c0f..315a7fb 100644 --- a/__main__.py +++ b/__main__.py @@ -6,7 +6,7 @@ import typer from coherent.build import bootstrap -from jaraco.vcs import repo +from jaraco.vcs import Repo from jaraco.versioning import Versioned, semver @@ -42,13 +42,23 @@ def build() -> None: def tag( kind_or_name: str, context: typer.Context, - location: Annotated[str, typer.Option('-C', help='Path to repository.')] = '.', + repository: Annotated[ + Repo, + typer.Option( + '-R', '--repository', + help='Path to repository.', + parser=Repo.detect, + ), + ] = '.', ) -> None: if kind_or_name in Versioned.semantic_increment: - name = semver(repo(location).get_next_version(kind_or_name)) + name = semver(repository.get_next_version(kind_or_name)) else: name = kind_or_name - subprocess.run(['git', '-C', location, 'tag', '-a', name, *context.args]) + subprocess.run([ + 'git', '-C', repository.location, 'tag', '-a', name, + '-m', '', *context.args] + ) if __name__ == '__main__':