Skip to content

Way to make a re-usable recipe code block? #1707

Answered by laniakea64
johnalotoski asked this question in Q&A
Discussion options

You must be logged in to vote

For those examples you could use set positional-arguments -

set positional-arguments

common := '''
  ARG1="$1"

  # Do common stuff ...
'''

recipe1 ENV:
  #!/usr/bin/env bash
  {{common}}
  # Do some stuff...

recipe2 ENV:
  #!/usr/bin/env bash
  {{common}}
  # Do some other stuff...

Does this work for your case?

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@johnalotoski
Comment options

@casey
Comment options

casey Dec 2, 2024
Maintainer

Answer selected by johnalotoski
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants