import{n as e,r as t,t as n}from"./chunk-74CEPOFO-V0JXh91S.mjs";var r={name:`rev`,summary:`reverse lines characterwise`,usage:`rev [file ...]`,description:`Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.`,examples:[`echo 'hello' | rev     # Output: olleh`,`rev file.txt           # Reverse each line in file`]};function i(e){return Array.from(e).reverse().join(``)}var a={name:`rev`,execute:async(a,o)=>{if(n(a))return t(r);let s=[];for(let t of a)if(t===`--`){let e=a.indexOf(t);s.push(...a.slice(e+1));break}else{if(t.startsWith(`-`)&&t!==`-`)return e(`rev`,t);s.push(t)}let c=``,l=e=>{let t=e.split(`
`),n=e.endsWith(`
`)&&t[t.length-1]===``;return n&&t.pop(),t.map(i).join(`
`)+(n?`
`:``)};if(s.length===0)c=l(o.stdin??``);else for(let e of s)if(e===`-`){let e=o.stdin??``;c+=l(e)}else{let t=o.fs.resolvePath(o.cwd,e),n=await o.fs.readFile(t);if(n===null)return{exitCode:1,stdout:c,stderr:`rev: ${e}: No such file or directory
`};c+=l(n)}return{exitCode:0,stdout:c,stderr:``}}},o={name:`rev`,flags:[],stdinType:`text`,needsFiles:!0};export{a as n,o as t};
//# sourceMappingURL=chunk-QCDB2VPH-Bays5mAr.mjs.map