Skip to content

Commit

Permalink
fix usage of the makim object inside the generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab committed Nov 29, 2024
1 parent d7f33ff commit c74229c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/makim/cli/auto_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ def create_dynamic_command(
function_code += f' makim.run({args_param_str})\n'

local_vars: dict[str, Any] = {}
exec(function_code, globals(), local_vars)
global_vars: dict[str, Any] = globals()
global_vars['makim'] = makim

exec(function_code, global_vars, local_vars)
dynamic_command = decorator(local_vars['dynamic_command'])

# Apply Click options to the Typer command
Expand Down Expand Up @@ -278,5 +281,8 @@ def create_dynamic_command_cron(
function_code += f' makim.run({args_param_str})\n'

local_vars: dict[str, Any] = {}
exec(function_code, globals(), local_vars)
global_vars: dict[str, Any] = globals()
global_vars['makim'] = makim

exec(function_code, global_vars, local_vars)
decorator(local_vars['dynamic_command'])

0 comments on commit c74229c

Please sign in to comment.