Is there a utility that maps the include:: "genealogy" of a given file
My team and I use asciidoc includes to transclude content files into multiple assemblies, chapters, and/or guides.
Currently, we use a comment in the content file to manually record the "parent" files (called an assembly file) that include the content file as well as the names of the top level guides in which it appears (e.g., Getting Started Guide, Administration Guide).
Unfortunately, we sometimes forget to update this information.
Does anyone know of a utility or script (in bash, python, or any other language) that maps the genealogy of a "child" file on up through its "parents" (files that contain include::childname) up to the top level?
In my imagination, this utility:
- uses a project folder as the starting point (docs-Red_Hat_Enterprise_Virtualization)
- takes a filepath and filename as an argument
- greps the project folder for that filename
- identifies the parent/ancestor files
- excludes false parents (i.e., excludes parents of files in different directory that have the identical filename)
- outputs the ancestry to a human-readable file.
Re: Is there a utility that maps the include:: "genealogy" of a given file
From your question I guess that you add the comments so that a human knowns where the file is used.
The AsciiDoc plugin for IntelliJ can give you this using "Find Usages" (Ctrl+F7) if you apply it to the file (not for example to a class name or something similar) and it will show you all include directives that point to this file
If you want to use this information for something else, please comment.