import{a as b}from"./chunk-YN4NV3BE.js";import{a as d}from"./chunk-HWKDQ44K.js";import{a as m,b as p}from"./chunk-74CEPOFO.js";var f={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number           number all output lines","    --help             display this help and exit"]},g={number:{short:"n",long:"number",type:"boolean"}},F={name:"cat",async execute(o,r){if(p(o))return m(f);let e=d("cat",o,g);if(!e.ok)return e.error;let a=e.result.flags.number,t=e.result.positional,n=await b(r,t,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),s="",l=1;for(let{content:i}of n.files)if(a){let c=y(i,l);s+=c.content,l=c.nextLineNumber}else s+=i;let u=t.length>0&&t.some(i=>i!=="-");return{stdout:s,stderr:n.stderr,exitCode:n.exitCode,...n.observations?{observations:n.observations}:{},...u?{stdoutEncoding:"binary"}:{}}}};function y(o,r){let e=o.split(`
`),a=o.endsWith(`
`),t=a?e.slice(0,-1):e;return{content:t.map((s,l)=>`${String(r+l).padStart(6," ")}	${s}`).join(`
`)+(a?`
`:""),nextLineNumber:r+t.length}}var w={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0};export{F as a,w as b};
