Skip to content

Conversation

@bDgcgsX4bnc3Duprdb2S
Copy link

Add macro support for args and kwargs
Eg: """set ip {{ ip | IP | macro("myfunc", "arg1", "arg2", key="value") }}"""

TODO: Fix macro doc saying macros are based on exec (they are NOT) and describe new args and kwargs behavior

Add macro support for args and kwargs
Eg: """set ip {{ ip | IP | macro("myfunc", "arg1", "arg2", key="value") }}"""
TODO: Fix macro doc saying macros are based on exec (they are NOT) and describe new args and kwargs behavior
@dmulyalin
Copy link
Owner

Hello, thank you for PR, could you advise what is the usecase for that?

@bDgcgsX4bnc3Duprdb2S
Copy link
Author

Imagine trying to build a date from a string with a specific format:

  • template="""set date {{ date | re(...)| macro("datetime.strptime", "%d/%m/%y %H:%M:%S.%f") }}"""
  • data="""set date 31/01/22 23:59:59.999999"""

BTW and FYI, this fix unfortunately won't work with group macros because they are implemented differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants