@@ -846,6 +846,47 @@ generates the documentation for all sub-commands.
846
846
You can also find the generated documentation for the =clingon-demo=
847
847
app in the =docs/= directory of the =clingon= repo.
848
848
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
+
849
890
* Command Hooks
850
891
851
892
=clingon= allows you to associate =pre= and =post= hooks with a
0 commit comments