Skip to content

Exposing the current recipe name as (environmental) variable or via a function #2620

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

You must be logged in to vote

So to be clear, in your example, you're looking for just test to do

echo "test"
mkdir "test"
touch "test/default.conf"

and for just live to do

echo "live"
mkdir "live"
touch "live/default.conf"

I don't think this is currently possible - this would be the depending_recipe() function idea proposed in #2411 (comment)

As a workaround, you could pass a recipe parameter to _a:

_a recipe:
  echo "{{ recipe }}"
  @mkdir "{{ recipe }}"
  @touch "{{ recipe }}/default.conf"
 
test: (_a 'test')

live: (_a 'live')

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@almereyda
Comment options

Answer selected by almereyda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants