Skip to content

Commit fca504a

Browse files
fix helper script issues (#6)
1 parent 0a75d65 commit fca504a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.bin/bump.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
import re
1212
import subprocess
13-
import sys
1413
from enum import Enum
1514
from pathlib import Path
1615
from typing import Annotated
16+
from typing import override
1717

1818
import typer
1919
from rich.console import Console
@@ -22,13 +22,19 @@
2222
console = Console()
2323

2424

25-
class Version(str, Enum):
25+
class StrEnum(str, Enum):
26+
@override
27+
def __format__(self, format_spec: str) -> str:
28+
return format(self.value, format_spec)
29+
30+
31+
class Version(StrEnum):
2632
MAJOR = "major"
2733
MINOR = "minor"
2834
PATCH = "patch"
2935

3036

31-
class Tag(str, Enum):
37+
class Tag(StrEnum):
3238
DEV = "dev"
3339
ALPHA = "alpha"
3440
BETA = "beta"
@@ -55,7 +61,7 @@ def run(
5561
try:
5662
return subprocess.check_output(cmd, text=True, stderr=subprocess.STDOUT).strip()
5763
except subprocess.CalledProcessError as e:
58-
console.print(f"[red]{cmd[0]} failed: {e.output}[/red]", file=sys.stderr)
64+
console.print(f"[red]{cmd[0]} failed: {e.output}[/red]")
5965
raise typer.Exit(1) from e
6066

6167

.bin/release.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import re
1111
import subprocess
12-
import sys
1312
from typing import Annotated
1413

1514
import typer
@@ -38,7 +37,7 @@ def run(
3837
try:
3938
return subprocess.check_output(cmd, text=True, stderr=subprocess.STDOUT).strip()
4039
except subprocess.CalledProcessError as e:
41-
console.print(f"[red]{cmd[0]} failed: {e.output}[/red]", file=sys.stderr)
40+
console.print(f"[red]{cmd[0]} failed: {e.output}[/red]")
4241
raise typer.Exit(1) from e
4342

4443

0 commit comments

Comments
 (0)