List available recipes as a graph or tree
Hi there! Is there a way to quickly check the recipe dependencies? I checked the Listing Available Recipes page but it's not mentioned.
If not existing, I think it could be worth to implement.
Let's take an example.
Based on this Justfile found in the documentation :
# Justfile
a:
echo 'A!'
b: a
echo 'B start!'
just c
echo 'B end!'
c:
echo 'C!'
We could execute the following command :
just --list --graph
And we could clearly see the recipe dependencies :
├── a
├── b
│ ├── a
│ └── c
└── c
What do you think?
Love this idea! I think calling it just --tree would be good, similar to the CLI tree command that prints a directory tree.
Displaying calls like "just c" as a dependency in the tree can be difficult. What to do in a case:
bin := "just" // it can be a conditional here
a:
echo "a"
{{bin}} b
b:
echo "b"
or in this case:
section := if windows { "build-win" } else { "build-lin" }
a:
just {{section}}
echo "Done"
build-win:
...
build-lin:
...
I can think of more complex cases, but even these ones are tricky.
Oh sorry, I missed that part. Yeah, I think that displaying dependencies which are called inside recipes is not possible.
Oh sorry, I missed that part. Yeah, I think that displaying dependencies which are called inside recipes is not possible.
Perhaps we adjust the definition of dependency a bit? To me, lah := "blah" is an assignment statement, which shouldn't be a dependency, right? Otherwise, this idea has flopped since assignments are (almost) always used in recipes.
Can you consider this point too?