Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add --target flag #1725

Merged
merged 2 commits into from
Nov 28, 2023
Merged

cli: add --target flag #1725

merged 2 commits into from
Nov 28, 2023

Conversation

landmaj
Copy link
Contributor

@landmaj landmaj commented Nov 12, 2023

closes #1707
closes #1727

This PR adds --target flag which allows exporting a single board from a multi-board diagram.

a -> b
layers: {
  x: {
    c -> d
  }
}

Layer "b" can be exported with one of the following commands:

d2 --target x index.d2
d2 --target layers.x index.d2

EDIT: comment updated to reflect changes after review.

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the future D2 should allow exporting just a container from a diagram, which can reuse this flag if we call it --render-target or something.

cc @gavin-ts any alt name suggestions?

d2cli/main.go Outdated Show resolved Hide resolved
d2cli/main.go Outdated Show resolved Hide resolved
d2cli/main.go Outdated Show resolved Hide resolved
d2cli/main.go Outdated Show resolved Hide resolved
@landmaj landmaj changed the title cli: add --board flag cli: add --render-target flag Nov 13, 2023
@gavin-ts
Copy link
Contributor

I think in the future D2 should allow exporting just a container from a diagram, which can reuse this flag if we call it --render-target or something.

cc @gavin-ts any alt name suggestions?

hmm maybe the target is implicit, I think I would prefer using d2 --render root.x index.d2 over d2 --render-target root.x index.d2

--render [target]
Render a single board from multi-board diagram. E.g. root.scenarios.x to render only scenario x. If not provided, the entire diagram is rendered

@alixander
Copy link
Collaborator

alixander commented Nov 13, 2023

I don't think it's implicit. With just a --render flag, I'd think it's possible that it controls render format, or resolution. --render-target [path]

@landmaj
Copy link
Contributor Author

landmaj commented Nov 13, 2023

It could also be just --target. This is how Docker handles building specific stages.

@alixander
Copy link
Collaborator

--target sounds good to me.

@landmaj landmaj force-pushed the board_flag branch 2 times, most recently from 2759e72 to c09bef6 Compare November 13, 2023 18:59
@landmaj landmaj changed the title cli: add --render-target flag cli: add --target flag Nov 13, 2023
@landmaj
Copy link
Contributor Author

landmaj commented Nov 13, 2023

PR updated to use --target flag.

Copy link
Contributor

@gavin-ts gavin-ts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! looks good to me

@gavin-ts gavin-ts merged commit 9925980 into terrastruct:master Nov 28, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix board lookup for layer names with / cli: --board flag
3 participants