feat: add config validation and send dry-run
This commit is contained in:
@@ -10,6 +10,7 @@ export async function sendCommand(
|
||||
wait: string;
|
||||
poll: string;
|
||||
provider: Provider;
|
||||
dryRun?: boolean;
|
||||
},
|
||||
deps: CliDeps,
|
||||
runtime: RuntimeEnv,
|
||||
@@ -26,6 +27,12 @@ export async function sendCommand(
|
||||
}
|
||||
|
||||
if (opts.provider === "web") {
|
||||
if (opts.dryRun) {
|
||||
runtime.log(
|
||||
`[dry-run] would send via web -> ${opts.to}: ${opts.message}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (waitSeconds !== 0) {
|
||||
runtime.log(info("Wait/poll are Twilio-only; ignored for provider=web."));
|
||||
}
|
||||
@@ -33,6 +40,13 @@ export async function sendCommand(
|
||||
return;
|
||||
}
|
||||
|
||||
if (opts.dryRun) {
|
||||
runtime.log(
|
||||
`[dry-run] would send via twilio -> ${opts.to}: ${opts.message}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await deps.sendMessage(opts.to, opts.message, runtime);
|
||||
if (!result) return;
|
||||
if (waitSeconds === 0) return;
|
||||
|
||||
Reference in New Issue
Block a user