Simple Diagrams For Easytree tool

Applications of my simple diagrams

In the previous post about my simple diagrams I demonstrated how they are easy and intuitive and how they cover the same functionality as semantic nets, some of UML diagrams, FlowChart, Grafcet and many others - they are just route maps! Another example: Easytree tool.

The idea of easytree is simple: it parses output of tree(1) command (which can be got from AI chat or from some documentation as well) and either recreates the same tree (possibly prepending with some folder) or produces POSIX shell script doing the same (it has also dry mode allowing just to check what will be created).

There are many different algorithms in easytree, some of them are:

  1. detect of indentation and entry name
  2. extract of paths from tree(1) output

The first algorithm can be drawn as:

Decorators, " ", but "-"
Decorators, " "...
"-"
"-"
" "
" "
Alphanum
Alphanum
Indent found
Indent found

As usual, the bold boxes are kind of "road signs": ie, conditions - you pass through it only if you satisfy the condition/sign.

The second algorithm can be drawn as:

first
line
first...
line ->
indent, name
line ->...
non-first
line
non-fir...
stack <-
indent, name
stack <-...
indent
to left
indent...
indent
to right
indent...
indent same
indent same
pop until
this indent (including)
pop until...
path <- path from stack
'/'
name
path <- path...
stack <-
indent, name
stack <-...
recur:
results <-
path
recur:...
А
А
А
А
curdir <-
path
curdir <-...
path <-
name
path <-...
last result <-
last result "/"
last result <-...

In this diagram we see:

  • "road signs"/conditions
  • routes (like "A"): from the box "non-first line" we visit "line -> indent,name" box and

then we return to the "switch" "indent to left", "indent to right", "indent same"

  • symbols "->" and "<-" are used meaning "get from", "put to"
  • the box with "recur: …" means "go to recursion" - the algorithm is recursive