Skip to content

Commit

Permalink
feat(cli): add hidden run --dry-run argument
Browse files Browse the repository at this point in the history
adds a `--dry-run` argument to `cartesi run` command so it's possible to
see the .yaml file used by docker compose to start the local infratructure
  • Loading branch information
endersonmaia committed Aug 21, 2024
1 parent a256dca commit c779501
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-toes-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

adds --dry-run to run command
14 changes: 14 additions & 0 deletions apps/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export default class Run extends BaseCommand<typeof Run> {
description: "port to listen for incoming connections",
default: 8080,
}),
"dry-run": Flags.boolean({
description: "show the docker compose configuration",
default: false,
hidden: true,
}),
};

public async run(): Promise<void> {
Expand Down Expand Up @@ -169,6 +174,15 @@ export default class Run extends BaseCommand<typeof Run> {
process.on("SIGINT", () => {});

try {
if (flags["dry-run"]) {
// show the docker compose configuration
await execa("docker", [...compose_args, "config"], {
env,
stdio: "inherit",
});
return;
}

// run compose environment
await execa("docker", [...compose_args, "up", ...up_args], {
env,
Expand Down

0 comments on commit c779501

Please sign in to comment.