Skip to content

Add `dico draw` subcommand

Medina Cardenas, Lorena Giovanna requested to merge dico-draw into master

Description

The purpose of this merge request is to implement the dico draw subcommand.

More precisely, it allows the user to build a DOT file of the the dictionary graph. The input file is a dictionary in format JSON. The JSON input and DOT output are read from stdin and written to stdout by default.

Examples

After merge, the following commands are available:

# Using an input and an output file:
$ bin/dico draw -v -i sample/json/386_thing.json -o 386_thing_graph.dot
# Using stdin and stdout
$ bin/dico draw -v < sample/json/386_thing.json

Example DOT file

strict digraph  {
node [shape=circle];
0 [label="huge;a"];
1 [label="large;a"];
2 [label="small;a"];
1 -> 0;
1 -> 2;
2 -> 1;
}

Modified files

  • dico.py: to add subcommand
  • draw.py: to parse the arguments and apply them
  • digraph.py: to build the DOT file
  • bats/test_dico_draw.bats: to add new tests
  • README: to add subcommand information

Added examples

  • sample/dot/small_graph.dot : DOT file
  • images/small_graph.png : image
Edited by Medina Cardenas, Lorena Giovanna

Merge request reports