mix workspace.graph (Workspace v0.2.1)
View SourcePrints the workspace graph.
$ mix workspace.graph
Formatters
By default the graph will be pretty printed in the terminal:
$ mix workspace.graph
:api
├── :accounts
│ └── :ecto_utils
├── :cli_tools
└── :orders
├── :string_utils
└── :warehouse
└── :ecto_utils
:back_office
└── :cli_tools
You can also format it as mermaid
or dot
:
$ mix workspace.graph --format dot
digraph G {
accounts -> ecto_utils;
api -> accounts;
api -> cli_tools;
api -> orders;
back_office -> cli_tools;
orders -> string_utils;
orders -> warehouse;
warehouse -> ecto_utils;
}
Showing project's statuses
If you pass the --show-status
flag the project statuses are also
included.
$ mix workspace.graph --show-status
:api ✚
├── :accounts ✔
│ └── :ecto_utils ✔
├── :cli_tools ✚
└── :orders ✔
├── :string_utils ✔
└── :warehouse ✔
└── :ecto_utils ✔
:back_office ●
└── :cli_tools ✚
The following color coding is used:
- Modified projects are shown in red color
- Affected projects are shown in orange color
Focusing the graph around a project
You can focus the graph around a single project by passing the --focus
option.
$ mix workspace.graph --focus api
:api
├── :accounts
├── :cli_tools
└── :orders
This will print the graph around cli_tools
including only it's children
and parents that have a distance of 1 edge from it. You can widen the
picture by setting the --proximity
flag.
External dependencies
By default only the workspace projects are included in the graph. You
can however include the external dependencies by passing the --external
flag:
$ mix workspace.graph --external
:api
├── :accounts
│ └── :ecto_utils
│ └── :poison (external)
├── :cli_tools
└── :orders
├── :string_utils
│ └── :ex_doc (external)
└── :warehouse
└── :ecto_utils
:back_office
└── :cli_tools
Command Line Options
--external
(boolean
) - If set external dependencies will also be inlcuded in the generated graph. [default:false
]--focus
(string
) - If set the graph will be focused around the given project. Should be combined with:proximity
in order to define the depth of inward and outward neighbours to be displayed.--format
(string
) - The output format of the graph. It can be one of the following:pretty
- pretty prints the graph as a tree.plain
- does not use Unicode code points for formatting the tree.mermaid
- exports the graph as a mermaid graph.dot
- produces a graphviz DOT graph description of the workspace. Allowed values:["pretty", "plain", "mermaid", "dot"]
. [default:pretty
]
--proximity
(integer
) - The maximum allowed proximity between a graph's project and children or parent projects. Only applicable if:focus
is set. [default:1
]
Workspace status options
Status is retrieved from the diff between the given --base
and --head
. Knowing the
changed files we can limit the execution of workspace commands only to relevant projects.
--base
(string
) - The base git reference to compare the head to. Applied only when--affected
or--modified
are set.--head
(string
) - A reference to the git head. Applied only if--base
is set for getting the changed files [default:HEAD
]
Filtering options
-e, --exclude...
(string
) - Ignore the given projects [values can be grouped with the,
separator]
Display options
--show-status
(boolean
) - If set the status of each project will be included in the output graph [default:false
]--show-tags
(boolean
) - If set the project's tags are also included in the generated graph. Currently applicable only for:pretty
and:plain
formatters. [default:false
]
Global workspace options
--config-path
(string
) - The path to the workspace config to be used, relative to the workspace path [default:.workspace.exs
]--workspace-path
(string
) - If set it specifies the root workspace path, defaults to current directory