Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jul 31, 2023
1 parent 6127138 commit 48f5712
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions docs/tour/globs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Globs

:::caution Alpha
Globs are an alpha feature in 0.6.0. It is likely to change in behavior in followup minor
releases. In particular, the current plan is for globs to be lazy evaluated, so that it
can be used to set defaults, as opposed to the current implementation where it is
evaluated as it appears.
:::

:::note Etymology
> The glob command, short for global, originates in the earliest versions of Bell Labs' Unix... to expand wildcard characters in unquoted arguments ...
Expand All @@ -22,21 +29,6 @@ iphone 12 mini

<div style={{width: 600}} className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/globs-intro.svg2')}}></div>

:::info Order
Order matters in D2. When you add a glob statement, it will only match with what's already
been declared.

```d2
# These will be red
a
b
*.style.fill: red
# These will not be red
c
d
```
:::

## Globs are case insensitive

```d2
Expand All @@ -55,12 +47,20 @@ teacher
thriller
thrifter
t*h*r.shape: person
```

<div style={{width: 600}} className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/globs-multiple.svg2')}}></div>

```d2
a: {
b
c
}
a.*.c -> c
```

## Glob connections

You can use globs to create connections.
Expand Down Expand Up @@ -202,6 +202,10 @@ catapult: {

<div style={{width: 600}} className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/globs-filter-2.svg2')}}></div>

:::info
We are working on adding more filters.
:::

## Nested globs

You can nest globs, combining the features above.
Expand Down

0 comments on commit 48f5712

Please sign in to comment.