@@ -29,6 +29,7 @@ async def async_main(argv: list[str] | None = None) -> int:
2929 description = "Tool to update Python typing syntax." ,
3030 formatter_class = CustomHelpFormatter ,
3131 )
32+ formatter_options = parser .add_argument_group ("select optional formatter" )
3233 mode_options = parser .add_argument_group ("select different mode" )
3334 py_version_options = parser .add_argument_group ("python version options" )
3435
@@ -60,14 +61,21 @@ async def async_main(argv: list[str] | None = None) -> int:
6061 help = "Keep updates even if no import was removed" ,
6162 )
6263 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 (
6371 '--black' ,
6472 action = 'store_true' ,
65- help = "Run black formatting after update" ,
73+ help = "Run ' black' after update" ,
6674 )
67- parser .add_argument (
68- '--disable-committed-check ' ,
75+ group_formatter .add_argument (
76+ '--ruff ' ,
6977 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 " ,
7179 )
7280
7381 group_mode = mode_options .add_mutually_exclusive_group ()
@@ -95,11 +103,11 @@ async def async_main(argv: list[str] | None = None) -> int:
95103 group_py_version .add_argument (
96104 '--py38-plus' ,
97105 action = 'store_const' , dest = 'min_version' , const = (3 , 8 ),
98- help = "Default"
99106 )
100107 group_py_version .add_argument (
101108 '--py39-plus' ,
102109 action = 'store_const' , dest = 'min_version' , const = (3 , 9 ),
110+ help = "Default"
103111 )
104112 group_py_version .add_argument (
105113 '--py310-plus' ,
@@ -127,10 +135,17 @@ async def async_main(argv: list[str] | None = None) -> int:
127135
128136 if args .black :
129137 try :
130- # pylint: disable=unused-import,import-outside-toplevel
138+ # pylint: disable-next =unused-import,import-outside-toplevel
131139 import black # noqa: F401
132140 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" )
134149 return 2
135150
136151 return await async_run (args )
0 commit comments