Graph easy工具

Graph easy是一种用于在Cli下的绘图工具

Posted by Cheney.Yin on June 22, 2021

基本语法

graph-easy兼容graphviz语法

1
2
3
4
echo '[hello]<->[world]' | graph-easy
+-------+      +-------+
| hello | <--> | world |
+-------+      +-------+
1
2
3
4
echo '[hello]<->[world]->[OK]\n' | graph-easy
+-------+      +-------+     +----+
| hello | <--> | world | --> | OK |
+-------+      +-------+     +----+
1
2
3
4
5
6
7
8
9
10
11
echo '[hello]<->[world]->[OK]\n[good]->[world]' | graph-easy
+------+     +-------+     +----+
| good | --> | world | --> | OK |
+------+     +-------+     +----+
               ^
               |
               |
               v
             +-------+
             | hello |
             +-------+

嵌入子图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
echo '(ns0-1: [veth1]) [veth0]<->[veth1] [veth0]<->[brt]' | graph-easy
  +-------+        +-----+
  | veth0 |   <--> | brt |
  +-------+        +-----+
    ^
    |
    |
    v
+ - - - - - +
' ns0-1:    '
'           '
' +-------+ '
' | veth1 | '
' +-------+ '
'           '
+ - - - - - +

连接线加标签

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
echo '(ns0-1: [veth1]) [veth0]<->{label:"pair"}[veth1] [veth0]<->[brt]' | graph-easy
  +-------+        +-----+
  | veth0 |   <--> | brt |
  +-------+        +-----+
    ^
    |
    | pair
    v
+ - - - - - +
' ns0-1:    '
'           '
' +-------+ '
' | veth1 | '
' +-------+ '
'           '
+ - - - - - +