Skip to content

Commit

Permalink
garden.diagram() gains an includePrivate optional argument.
Browse files Browse the repository at this point in the history
Part of #1.
  • Loading branch information
jkomoros committed Jul 10, 2023
1 parent ba55515 commit bf1a065
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Garden {
return warnings;
}

diagram() : MermaidDiagramDefinition {
diagram(includePrivate = false) : MermaidDiagramDefinition {
const lines = [
'flowchart TB'
];
Expand All @@ -220,6 +220,7 @@ export class Garden {
for (const location of Object.keys(locationsMap)) {
const seeds = this._seeds[location] || [];
for (const seed of Object.values(seeds)) {
if (seed.private && !includePrivate) continue;
for (const ref of Object.values(seed.references())) {
//if it's not in our list of locations to enumerate then we'll treat it as remote
if (ref.packet && !locationsMap[ref.packet]) {
Expand All @@ -243,6 +244,7 @@ export class Garden {
const seeds = this._seeds[location] || [];
lines.push('subgraph ' + location);
for (const seed of Object.values(seeds)) {
if (seed.private && !includePrivate) continue;
lines.push('\t' + mermaidSeedReference(seed.ref) + '[' + (seed.id || '\'\'') + ']');
if (seed.type == 'dynamic') lines.push('\tstyle ' + mermaidSeedReference(seed.ref) + ' fill:#006600');
for (const [key, ref] of Object.entries(seed.references())) {
Expand Down

0 comments on commit bf1a065

Please sign in to comment.