import{a as d}from"./chunk-HWKDQ44K.js";import{a as p,b as l}from"./chunk-74CEPOFO.js";var m={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append     append to the given FILEs, do not overwrite","    --help       display this help and exit"]},u={append:{short:"a",long:"append",type:"boolean"}},w={name:"tee",async execute(r,e){if(l(r))return p(m);let t=d("tee",r,u);if(!t.ok)return t.error;let{append:f}=t.result.flags,c=t.result.positional,o=e.stdin,s="",a=0;for(let i of c)try{let n=e.fs.resolvePath(e.cwd,i);f?await e.fs.appendFile(n,o,"binary"):await e.fs.writeFile(n,o,"binary")}catch{s+=`tee: ${i}: No such file or directory
`,a=1}return{stdout:o,stderr:s,exitCode:a,stdoutEncoding:"binary"}}},b={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0};export{w as a,b};
