@@ -66,7 +66,7 @@ def parse_args(self, ctx, args):
6666
6767 # Store the script path and remaining args in the context
6868 ctx .params ['exec_file' ] = script_path
69- ctx .params [ 'args' ] = new_args
69+ ctx .obj . pargs = new_args
7070
7171 return [] # No more arguments to process
7272
@@ -78,18 +78,19 @@ def parse_args(self, ctx, args):
7878@click .option ('-e' , '--exec' , 'exec_file' ,
7979 type = click .Path (exists = True , dir_okay = False ),
8080 help = 'Run the specified Python file with the CLI environment.' )
81- @click .argument ('args' , nargs = - 1 , type = click .UNPROCESSED )
8281@click .version_option (message = 'ocebuild-cli %(version)s' , version = __version__ )
8382@click .pass_context
84- def cli (ctx , exec_file = None , args = None ):
83+ def cli (ctx , exec_file = None ):
8584 """Main runner for the CLI."""
85+
8686 if exec_file and ctx .invoked_subcommand is None :
8787 try :
8888 # Run python script in a controlled namespace (inherits pyinstaller env)
8989 import runpy , sys
9090
91- sys .argv = [exec_file ] + list (args ) if args else [exec_file ]
92- ctx .obj .__dict__ ['argv' ] = list (args ) if args else []
91+ args = ctx .obj .pargs
92+ sys .argv = [exec_file ] + list (args )
93+ ctx .obj .__dict__ ['argv' ] = args
9394
9495 runpy .run_path (exec_file , run_name = "__main__" , init_globals = ctx .obj .__dict__ )
9596 return
0 commit comments