@@ -29,6 +29,7 @@ async def async_main(argv: list[str] | None = None) -> int:
29
29
description = "Tool to update Python typing syntax." ,
30
30
formatter_class = CustomHelpFormatter ,
31
31
)
32
+ formatter_options = parser .add_argument_group ("select optional formatter" )
32
33
mode_options = parser .add_argument_group ("select different mode" )
33
34
py_version_options = parser .add_argument_group ("python version options" )
34
35
@@ -60,14 +61,21 @@ async def async_main(argv: list[str] | None = None) -> int:
60
61
help = "Keep updates even if no import was removed" ,
61
62
)
62
63
parser .add_argument (
64
+ '--disable-committed-check' ,
65
+ action = 'store_true' ,
66
+ help = "Don't abort with uncommitted changes. Don't use it in production!" ,
67
+ )
68
+
69
+ group_formatter = formatter_options .add_mutually_exclusive_group ()
70
+ group_formatter .add_argument (
63
71
'--black' ,
64
72
action = 'store_true' ,
65
- help = "Run black formatting after update" ,
73
+ help = "Run ' black' after update" ,
66
74
)
67
- parser .add_argument (
68
- '--disable-committed-check ' ,
75
+ group_formatter .add_argument (
76
+ '--ruff ' ,
69
77
action = 'store_true' ,
70
- help = "Don't abort with uncommitted changes. Don't use it in production! " ,
78
+ help = "Run 'ruff check --fix' and 'ruff format' after update " ,
71
79
)
72
80
73
81
group_mode = mode_options .add_mutually_exclusive_group ()
@@ -95,11 +103,11 @@ async def async_main(argv: list[str] | None = None) -> int:
95
103
group_py_version .add_argument (
96
104
'--py38-plus' ,
97
105
action = 'store_const' , dest = 'min_version' , const = (3 , 8 ),
98
- help = "Default"
99
106
)
100
107
group_py_version .add_argument (
101
108
'--py39-plus' ,
102
109
action = 'store_const' , dest = 'min_version' , const = (3 , 9 ),
110
+ help = "Default"
103
111
)
104
112
group_py_version .add_argument (
105
113
'--py310-plus' ,
@@ -127,10 +135,17 @@ async def async_main(argv: list[str] | None = None) -> int:
127
135
128
136
if args .black :
129
137
try :
130
- # pylint: disable=unused-import,import-outside-toplevel
138
+ # pylint: disable-next =unused-import,import-outside-toplevel
131
139
import black # noqa: F401
132
140
except ImportError :
133
- print ("Error! Black is not installed" )
141
+ print ("Error! Black isn't installed" )
142
+ return 2
143
+ elif args .ruff :
144
+ try :
145
+ # pylint: disable-next=unused-import,import-outside-toplevel
146
+ import ruff # noqa: F401
147
+ except ImportError :
148
+ print ("Error! Ruff isn't installed" )
134
149
return 2
135
150
136
151
return await async_run (args )
0 commit comments