Globs
The glob command, short for global, originates in the earliest versions of Bell Labs' Unix... to expand wildcard characters in unquoted arguments ...
Globs are a powerful language feature to make global changes in one line.
Globs apply backwards and forwards
In the following example, the instructions are as follows:
- Create a shape
a
. - Apply a glob rule. This immediately applies to existing shapes, i.e.,
a
. - Create a shape
b
. Existing glob rules are re-evaluated, and applied if they meet the criteria. This does, so it applies tob
. - Same with
c
.
Globs are case insensitive
Globs can appear multiple times
Glob connections
You can use globs to create connections.
Notice how self-connections were omitted. While not entirely consistent with what you may expect from globs, we feel it is more pragmatic for this to be the behavior.
You can also use globs to target modifying existing connections.
Scoped globs
Notice that in the below example, globs only apply to the scope they are specified in.
Recursive globs
**
means target recursively.
Notice how machine B
was not captured. Similar to the exception with * -> *
omitting
self-connections, recursive globs in connections also make an exception for practical
diagramming: it only applies to non-container (AKA leaf) shapes.
Filters
Use &
to filter what globs target. You may use any reserved keyword to filter on.
Property filters
Aside from reserved keywords, there are special property filters for more specific targeting.
connected: true|false
leaf: true|false
Filters on array values
If the filtered attribute has an array value, the filter will match if it matches any element of the array.
Globs as filter values
Globs can also appear in the value of a filter. *
by itself as a value for a filter
means the key must be specified.
Connection endpoint filters
Connections can be filtered by properties on their source and destination shapes.
Endpoint filters also work with IDs, e.g. &src: b
.
Endpoint IDs are absolute. For example, a.c
instead of just c
, even if the glob is
declared within a
.
Inverse filters
Use !&
to inverse-filter what globs target.
Nested globs
You can nest globs, combining the features above.
Global globs
Triple globs apply globally to the whole diagram. The difference between a double glob and
a triple glob is that a triple glob will apply to nested layers
(see the section on
composition for more on layers
), as well as persist across imports.