just icon indicating copy to clipboard operation
just copied to clipboard

Add option to show recipe's description when running it - useful for CI

Open nyurik opened this issue 1 year ago • 2 comments

When running just recipes in CI, it might be good to print a description of each recipe before running it - by using some new optional flag, or maybe as part of the --verbose. This way anyone examining CI logs would have a better understanding of what each step is for, and possibly have some hints on how to fix it if it breaks

nyurik avatar Feb 19 '24 02:02 nyurik

As a workaround, you can achieve it this way, but a built-in optional feature would definitely be nicer.

# Performs foo task.
foo:
	@{{ if env("IS_CI", '') == '1' { \
	  quote(just_executable()) + ' -f ' + quote(justfile()) + " --list | \
	    grep -P '^ *foo ' | sed -Ee 's/^[^#]+# *//g'" \
	  } else { "" } \
	}}
	echo 'Running the recipe...'

This example prints recipe description only when running in CI that sets the example IS_CI environment variable to 1.

laniakea64 avatar Feb 21 '24 17:02 laniakea64

I think that would be useful. I think probably landing it as a new flag, maybe --explain, and then later think about whether or not it should be the default when --verbose is used.

casey avatar May 15 '24 01:05 casey

Done in #2319!

casey avatar Aug 29 '24 19:08 casey