import{r as e,t}from"./chunk-74CEPOFO-V0JXh91S.mjs";import{t as n}from"./chunk-HWKDQ44K-BJxdK4fT.mjs";import{n as r}from"./chunk-7L36YK2X-B3QRwLbB.mjs";var i={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`]},a={number:{short:`n`,long:`number`,type:`boolean`}},o={name:`cat`,async execute(o,c){if(t(o))return e(i);let l=n(`cat`,o,a);if(!l.ok)return l.error;let u=l.result.flags.number,d=l.result.positional,f=await r(c,d,{cmdName:`cat`,allowStdinMarker:!0,stopOnError:!1}),p=``,m=1;for(let{content:e}of f.files)if(u){let t=s(e,m);p+=t.content,m=t.nextLineNumber}else p+=e;let h=d.length>0&&d.some(e=>e!==`-`);return{stdout:p,stderr:f.stderr,exitCode:f.exitCode,...h?{stdoutEncoding:`binary`}:{}}}};function s(e,t){let n=e.split(`
`),r=e.endsWith(`
`),i=r?n.slice(0,-1):n;return{content:i.map((e,n)=>`${String(t+n).padStart(6,` `)}	${e}`).join(`
`)+(r?`
`:``),nextLineNumber:t+i.length}}var c={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{c as n,o as t};
//# sourceMappingURL=chunk-TXBZCHCQ-BxbbtyNr.mjs.map