Skip to content

Commit bc58972

Browse files
committed
Document how to generate the command's tree in Dot format
1 parent 98953e9 commit bc58972

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.org

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,47 @@ generates the documentation for all sub-commands.
846846
You can also find the generated documentation for the =clingon-demo=
847847
app in the =docs/= directory of the =clingon= repo.
848848

849+
** Generate tree representation of your commands in Dot
850+
851+
Using =CLINGON:PRINT-DOCUMENTATION= you can also generate the tree
852+
representation of your commands in [[https://en.wikipedia.org/wiki/DOT_(graph_description_language)][Dot]] format.
853+
854+
Make sure to check the =clingon.demo= system and the provided
855+
=clingon-demo= app, which provides an example command for generating
856+
the Dot representation.
857+
858+
The example below shows the generation of the Dot representation for
859+
the =clingon-demo= command.
860+
861+
#+begin_src shell
862+
> clingon-demo dot
863+
digraph G {
864+
node [color=lightblue fillcolor=lightblue fontcolor=black shape=record style="filled, rounded"];
865+
"clingon-demo" -> "greet";
866+
"clingon-demo" -> "logging";
867+
"logging" -> "enable";
868+
"logging" -> "disable";
869+
"clingon-demo" -> "math";
870+
"clingon-demo" -> "echo";
871+
"clingon-demo" -> "engine";
872+
"clingon-demo" -> "print-doc";
873+
"clingon-demo" -> "sleep";
874+
"clingon-demo" -> "zsh-completion";
875+
"clingon-demo" -> "dot";
876+
}
877+
#+end_src
878+
879+
We can generate the resulting graph using [[https://graphviz.org/][graphviz]].
880+
881+
#+begin_src shell
882+
> clingon-demo dot > clingon-demo.dot
883+
> dot -Tpng clingon-demo.dot > clingon-demo-tree.png
884+
#+end_src
885+
886+
This is what the resulting tree looks like.
887+
888+
[[./images/clingon-demo-tree.png]]
889+
849890
* Command Hooks
850891

851892
=clingon= allows you to associate =pre= and =post= hooks with a

images/clingon-demo-tree.png

32.8 KB
Loading

0 commit comments

Comments
 (0)