@lunora/cli
Version:
The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands
4 lines (3 loc) • 1.16 kB
JavaScript
import{isProcessStreamLogger as a,createStderrLogger as c}from"./createLogger-Cl18I8AX.mjs";import{resolveHint as m,isLunoraError as i,flattenHint as d}from"@lunora/errors";import{VisulimaError as f,renderError as p}from"@visulima/error";import{exitCodeForError as u}from"./EXIT_CODE-08cwt3MK.mjs";const S={description:"Output format: pretty (default) or json",name:"format",type:String},$=(t,e)=>e===void 0?{format:"pretty"}:e==="json"||e==="pretty"?{format:e}:{error:`${t}: unknown --format "${e}" — expected pretty | json`},v=(t,e)=>t==="json"&&a(e)?c():e,x=t=>{process.stdout.write(`${JSON.stringify(t,void 0,2)}
`)},g={filterStacktrace:()=>!1,hideErrorCodeView:!0},y=(t,e={})=>{const n=t instanceof Error?t.message:String(t),r=m(i(t)?{code:t.code,hint:t.hint,message:n}:n),o=r===void 0?[]:d(r).split(`
`);i(t)&&(o.length>0&&o.push(""),o.push(`\`${t.code}\` — exits ${String(u(t))}. Run \`lunora docs exit-codes\` for the table.`));const s=new f({hint:o.length===0?void 0:o,message:e.reason===void 0?n:`${e.reason}: ${n}`,name:t instanceof Error&&t.name.length>0?t.name:"Error"});return s.stack="",p(s,g)};export{S as O,x as a,v as l,$ as p,y as r};