Skip to content

Commit 42fe2d8

Browse files
authored
Merge pull request #22 from macalinao/igm/codama
Add `coda idl` command for printing the codama IDL
2 parents 17365ee + 0f83101 commit 42fe2d8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.changeset/three-rooms-retire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@macalinao/coda": patch
3+
---
4+
5+
Add coda idl command for printing the underlying codama IDL

packages/coda/src/bin/cli.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,23 @@ program
130130
}
131131
});
132132

133+
program
134+
.command("idl")
135+
.description("Print the Codama IDL to stdout")
136+
.option(
137+
"-c, --config <path>",
138+
"Path to coda.config.mjs file",
139+
"./coda.config.mjs",
140+
)
141+
.action(async (options: { config: string }) => {
142+
try {
143+
const { codama } = await processIdls(options);
144+
const root = codama.getRoot();
145+
console.log(JSON.stringify(root, null, 2));
146+
} catch (error) {
147+
console.error("Error printing IDL:", error);
148+
process.exit(1);
149+
}
150+
});
151+
133152
program.parse();

0 commit comments

Comments
 (0)