@lunora/cli
Version:
The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands
2 lines (1 loc) • 914 B
JavaScript
import{isLunoraError as d,findSolutionByMessage as p}from"@lunora/errors";import{EXIT_CODE as i,exitCodeForError as g}from"./EXIT_CODE-08cwt3MK.mjs";import{createLogger as f}from"./createLogger-Cl18I8AX.mjs";import{p as u,l as E,r as C,a as L}from"./render-lunora-error--4tmM6mt.mjs";import{P as F}from"./prompt-cancelled-BvsNxg_Q.mjs";const m=(s,r)=>{s!=="json"||r.delegated===!0||L({code:r.code,data:r.data,error:r.error})},N=s=>async r=>{const t=f(),a=u(r.commandName,r.options.format);if("error"in a){t.error(a.error),r.process.exit(i.USAGE);return}const{format:o}=a;try{const e=await s({argument:r.argument,cwd:r.process.cwd,format:o,logger:E(o,t),options:r.options});m(o,e),r.process.exit(e.code)}catch(e){if(e instanceof F){r.process.exit(i.CANCELLED);return}const n=e instanceof Error?e.message:String(e),c=g(e);t.error(d(e)||p(n)!==void 0?C(e):n),m(o,{code:c,error:n}),r.process.exit(c)}};export{N as d};