Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/achoum/drawtree
This script draws a tree (in text mode) front of a set of tabulated text file (see example).
https://github.com/achoum/drawtree
Last synced: about 1 month ago
JSON representation
This script draws a tree (in text mode) front of a set of tabulated text file (see example).
- Host: GitHub
- URL: https://github.com/achoum/drawtree
- Owner: achoum
- License: apache-2.0
- Created: 2016-10-22T18:13:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-05T21:21:50.000Z (over 7 years ago)
- Last Synced: 2024-10-29T14:18:09.409Z (3 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DrawTree
By Mathieu Guillame-bert
[email protected]## Description
DrawTree is a command line tool used to augment recursive lists (i.e. trees).
## Example
Input:
```
DoAny
EatSomeFood [extends DoAll]
EnsureItemInInventory(x,y=Food) [extends DoAny]
HasItemInInventory(x,y)
GetReachableItemFromGround(x,y) [extends DoAll]
FindReachableItemOnGround(x,y)
Goto(x)
Grab(x)
GetReachableItemFromContainer(x,y) [extends DoAll]
FindReachableItemInContainer(x,y,z)
Goto(z)
GrabFromContainer(x,z)
Eat(x)
RandomWalk
```Output:
```
DoAny
|
+--EatSomeFood [extends DoAll]
| |
| +--EnsureItemInInventory(x,y=Food) [extends DoAny]
| | |
| | +--HasItemInInventory(x,y)
| | +--GetReachableItemFromGround(x,y) [extends DoAll]
| | | |
| | | +--FindReachableItemOnGround(x,y)
| | | +--Goto(x)
| | | +--Grab(x)
| | +--GetReachableItemFromContainer(x,y) [extends DoAll]
| | |
| | +--FindReachableItemInContainer(x,y,z)
| | +--Goto(z)
| | +--GrabFromContainer(x,z)
| +--Eat(x)
+--RandomWalk
```Command line example:
```
echo -e "DoAny \n\
EatSomeFood [extends DoAll] \n\
EnsureItemInInventory(x,y=Food) [extends DoAny] \n\
HasItemInInventory(x,y) \n\
GetReachableItemFromGround(x,y) [extends DoAll] \n\
FindReachableItemOnGround(x,y) \n\
Goto(x) \n\
Grab(x) \n\
GetReachableItemFromContainer(x,y) [extends DoAll] \n\
FindReachableItemInContainer(x,y,z) \n\
Goto(z) \n\
GrabFromContainer(x,z) \n\
Eat(x) \n\
RandomWalk" | python drawtree.py
```## Options
There is currently command line options. Instead, the options are modifiable by editing various constants defined at the top of the script.
These options are:
- END_BRANCH: What to print in front of the last child (default: " +--")
- INTERM_BRANCH: What to print in front of a child (which is not the last child) (default: " +--")
- CONTINUITY: What to print to extand a branch (default:" | ")
- NOTHING: What to print when there is nothing (default:" ")
- ADD_SPACE: Should we skip a blank line between a node and its first child (default:True).