Skip to content

Commit

Permalink
Accept Repo as a CLI argument
Browse files Browse the repository at this point in the history
  • Loading branch information
bswck committed Aug 6, 2024
1 parent 066882b commit 53848f1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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__':
Expand Down

0 comments on commit 53848f1

Please sign in to comment.