File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # coding=utf-8
2- # !/usr/bin/env python
1+ from __future__ import annotations
2+
3+ import importlib .resources
34import os
45import subprocess
56import sys
67
78
8- def run (args = None ):
9+ def run (args : list [ str ] | None = None ) -> None :
910 arguments = ["java" ]
1011
11- if os .getenv ("JAVA_OPTS" ):
12- arguments .append (os .getenv ("JAVA_OPTS" ))
12+ java_opts = os .getenv ("JAVA_OPTS" )
13+ if java_opts :
14+ arguments .append (java_opts )
1315
1416 arguments .append ("-jar" )
1517
16- jar_path = os .path .join (
17- os .path .dirname (os .path .realpath (__file__ )), "openapi-generator.jar"
18- )
19- arguments .append (jar_path )
18+ jar_path = importlib .resources .files ("openapi_generator_cli" ) / "openapi-generator.jar"
19+ arguments .append (str (jar_path ))
2020
2121 if args and type (args ) == list :
2222 arguments .extend (args )
2323
24- subprocess .call (" " . join ( arguments ), shell = True )
24+ subprocess .call (arguments ) # noqa: S603
2525
2626
27- def cli ():
27+ def cli () -> None :
2828 args = []
2929 if len (sys .argv ) > 1 :
3030 args = sys .argv [1 :]
You can’t perform that action at this time.
0 commit comments