@@ -49,10 +49,10 @@ def main():
4949 remaining_args = args [1 :]
5050
5151 if command not in TOOLS_MAP :
52- print (f"Error: Unknown command '{ command } '\n " )
53- print ("Available commands:" )
52+ print (f"Error: Unknown command '{ command } '\n " , file = sys . stderr )
53+ print ("Available commands:" , file = sys . stderr )
5454 for cmd in TOOLS_MAP :
55- print (f" { cmd } " )
55+ print (f" { cmd } " , file = sys . stderr )
5656 sys .exit (1 )
5757
5858 module_name = TOOLS_MAP [command ]
@@ -62,12 +62,15 @@ def main():
6262 # Dynamically load the requested tool module
6363 module = importlib .import_module (full_module_name )
6464 except ImportError as e :
65- print (f"Error loading { full_module_name } : { e } " )
65+ print (f"Error loading { full_module_name } : { e } " , file = sys . stderr )
6666 sys .exit (1 )
6767
6868 # Import the argparse instance from the module
6969 if not hasattr (module , "parser" ):
70- print (f"Error: { full_module_name } does not expose a 'parser' instance." )
70+ print (
71+ f"Error: { full_module_name } does not expose a 'parser' instance." ,
72+ file = sys .stderr ,
73+ )
7174 sys .exit (1 )
7275
7376 # Use the instance to parse the remaining command line arguments
@@ -76,7 +79,10 @@ def main():
7679 if hasattr (module , "main" ):
7780 module .main (parsed_args )
7881 else :
79- print (f"Error: { full_module_name } does not have a 'main' function." )
82+ print (
83+ f"Error: { full_module_name } does not have a 'main' function." ,
84+ file = sys .stderr ,
85+ )
8086 sys .exit (1 )
8187
8288
0 commit comments