能否使用Graphviz绘制ASCII图表?
就像这样:
digraph
{
this -> is
this -> a
a -> test
}
得到了不期望的结果。
相反,我想获得类似的ASCII表示:
this
/ \
is a
|
test
如何从dot文件格式绘制ASCII图表?
http://search.cpan.org/~tels/Graph-Easy/
http://search.cpan.org/~tels/Graph-Easy/bin/graph-easy
在Mac上,您可以使用Homebrew和cpan安装此软件:brew install cpanminus
cpan Graph::Easy
cat dotfile.dot | /opt/local/libexec/perl5.12/sitebin/graph-easy
sudo apt-get install cpanminus
。sudo cpanm Graph::Easy
。cat your.dot | graph-easy --from=dot --as_ascii
。现在,在Ubuntu中,您可以直接安装和使用graph-easy:
> sudo apt install libgraph-easy-perl
[...]
> graph-easy dotfile.dot
+----+ +------+
| is | <-- | this |
+----+ +------+
|
|
v
+------+
| a |
+------+
|
|
v
+------+
| test |
+------+
apt
包,但我可以推荐graph-easy。它对于README.md文件非常有用。我希望它永远不会停止维护。 - Sridhar Sarnobat这里是Linux的等效命令:
首先安装cpanminus
sudo apt install cpanminus
安装GraphEasy后。sudo cpanm Graph::Easy
这里是一个使用示例
cat input.dot | graph-easy --from=dot --as_ascii
sudo cpanm Graph::Easy
,我得到了错误信息 ! Installing Graph::Easy failed. See /home/simon/.cpanm/work/1568099378.7482/build.log for details. Retry with --force to force install it.
- Simon Streicher/usr/local/man
。似乎是符号链接指向不存在的目录的问题:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583612#10。通过创建目录`sudo mkdir /usr/local/share/man/`来解决。 - Simon Streicherreturn if exists $self->{scope_stack}->[-1]->{_is_group};
。 - Petr Skociksudo apt install libgraph-easy-perl
直接安装graph-easy。 - nitrogen除了使用Graph::Easy
的ASCII功能外,另一个选择是通过我托管的这个小服务直接从您的浏览器中使用:
通过Docker使用graph-easy。您可以安装whalebrew,并使用它运行graph-easy,而无需在本地计算机上安装太多依赖项,除了whalebrew和docker之外。
在MacOS上使用homebrew安装docker。
$ brew install docker
$ docker -v # check if docker is running
$ brew install whalebrew
通过Whalebrew安装Graph-Easy
$ whalebrew install tsub/graph-easy
现在通过以下方式运行它:
$ echo '[a]->[b]' | graph-easy
+---+ +---+
| a | --> | b |
+---+ +---+
Whalebrew 会为 Docker 镜像创建别名,这样你就可以像运行本地命令一样运行它们。
- Sridhar Sarnobatwhalebrew
。您提供的用例真是太棒了! - Greg Hilston