File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1010
1111import re
1212import subprocess
13- import sys
1413from enum import Enum
1514from pathlib import Path
1615from typing import Annotated
16+ from typing import override
1717
1818import typer
1919from rich .console import Console
2222console = 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
Original file line number Diff line number Diff line change 99
1010import re
1111import subprocess
12- import sys
1312from typing import Annotated
1413
1514import 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
You can’t perform that action at this time.
0 commit comments