59
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

コマンドラインからフローチャートや図を描く方法

Posted at

例えば、Vimで図を描くには、DrawItが有名ですが、私の場合、こういった操作が複雑な、特にキーバーンドを覚えるのが面倒なプラグインを使うことはあまりありません。

ここで、Shell(Terminal)で描く事が多いのですが、そんな時は、graph-easyを使います。

ArchLinuxの場合、Perlは元から入ってるというか、ほとんどのOSには最初から入ってるので、以下のコマンドでインストールできると思います。

$ cpan Graph::Easy

以下の様な感じでフローチャートや図を書けます。

$ graph-easy <<<'[ MacBook Air ] -- LAN --> [ WOL Server ] -- LAN --> [ File Server ],[ Post Server ]'

+-------------+  LAN   +-------------+  LAN   +-------------+
| MacBook Air | -----> | WOL Server  | -----> | File Server |
+-------------+        +-------------+        +-------------+
                         |
                         | LAN
                         v
                       +-------------+
                       | Post Server |
                       +-------------+

$ graph-easy <<< '
digraph {
start -> adsuck;
adsuck -> block;
block -> noop[label=yes];
block -> unbound[label=no];
noop -> serve_noop[label=yes];
noop -> serve_empty[label=no];
}'


                      +-------------+
                      |    start    |
                      +-------------+
                        |
                        |
                        v
                      +-------------+
                      |   adsuck    |
                      +-------------+
                        |
                        |
                        v
+------------+  no    +-------------+
|  unbound   | <----- |    block    |
+------------+        +-------------+
                        |
                        | yes
                        v
+------------+  yes   +-------------+
| serve_noop | <----- |    noop     |
+------------+        +-------------+
                        |
                        | no
                        v
                      +-------------+
                      | serve_empty |
                      +-------------+
59
55
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
59
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?