just icon indicating copy to clipboard operation
just copied to clipboard

Consider inverting behavior of `@` on shebang recipes

Open casey opened this issue 5 years ago • 3 comments

Shebang recipes are quiet by default. This is somewhat confusing, since linewise recipes are not quiet by default.

The motivation for making shebang recipes quiet is that it isn't possible to print out each line of a shebang recipe as it is executed, since the recipe is passed in its entirety to an interpreter, and printing out the whole recipe before executing it isn't particularly useful.

I'm leaning towards leaving it this way, since I think it might be better to be more useful than to be more consistent. However, I'm not sure if I'm in the minority here, so I'm interested in what other people think.

casey avatar Mar 06 '20 03:03 casey

I agree that print a shebang recipe make people feel verbose, and then, I agree that we should just make shebang recipe keep quiet by default.

However, I think use @ to enable that print looks strange, because that symbol will have totally different meanings in shabang and linewise recipe. That, makes users can not know if a recipe is quiet, until he/she read both the body of a recipe (to know if this recipe is a shebang recipe), and the "title" of that (to know if it is marked by @).

I have a idea for that. We can keep a shabang recipe quiet with or without @. If we ask a quiet guy to be quiet, he/she will still quiet. And if someone want to print a shabang recipe, we add a new mark style, like @@ to make a "quiet" recipe "verbose".

shabang_task: # Default quiet
    #! /usr/bin/env python
    print('Hello')

@quiet_shabang_task: # Still quiet
    #! /usr/bin/env python
    print('Hello')

@@verbose_shabang_task: # Become Verbose
    #! /usr/bin/env python
    print('Hello')

linewise_task: # Default verbose
    echo Hello

@quiet_linewise_task: # Become quiet
    echo Hello

@@verbose_linewise_task: # Still verbose
    echo Hello

plus7wist avatar Mar 09 '20 09:03 plus7wist

While @@ is nice and concise, it might be hard to learn and remember what it does.

I think the right way to solve this is to add a general syntax for annotating recipes, and use that. I opened #604 to track adding the annotation syntax.

casey avatar Mar 09 '20 23:03 casey

Took me 10 mins to find this issue .. I didn't know why my @ annotation wasn't working in my Shebang recipe.

Turns out it was working

PaulRBerg avatar May 23 '25 16:05 PaulRBerg

I think this ships has kind of sailed, since it would be a disruptive change for shebang recipes to start printing their contents by default.

casey avatar Jun 24 '25 07:06 casey

might be worth adding a setting for undoing the default behavior?

PaulRBerg avatar Jun 24 '25 07:06 PaulRBerg