import{n as e}from"./chunk-3THT3N7L-B1WzJUh4.mjs";import{t}from"./chunk-44UOCSGV-BZ6LfyW2.mjs";import{t as n}from"./chunk-HWKDQ44K-BJxdK4fT.mjs";var r={recursive:{short:`r`,long:`recursive`,type:`boolean`},recursiveUpper:{short:`R`,type:`boolean`},force:{short:`f`,long:`force`,type:`boolean`},verbose:{short:`v`,long:`verbose`,type:`boolean`}},i={name:`rm`,async execute(i,a){let o=n(`rm`,i,r);if(!o.ok)return o.error;let s=o.result.flags.recursive||o.result.flags.recursiveUpper,c=o.result.flags.force,l=o.result.flags.verbose,u=o.result.positional;if(u.length===0)return c?{stdout:``,stderr:``,exitCode:0}:{stdout:``,stderr:`rm: missing operand
`,exitCode:1};let d=``,f=``,p=0;for(let n of u)try{let e=a.fs.resolvePath(a.cwd,n);if((await a.fs.stat(e)).isDirectory&&!s){f+=`rm: cannot remove '${n}': Is a directory
`,p=1;continue}await a.fs.rm(e,{recursive:s,force:c}),l&&(d+=`removed '${n}'
`)}catch(r){if(!c){let i=t(r);i.includes(`ENOENT`)||i.includes(`no such file`)?f+=`rm: cannot remove '${n}': No such file or directory
`:i.includes(`ENOTEMPTY`)||i.includes(`not empty`)?f+=`rm: cannot remove '${n}': Directory not empty
`:f+=`rm: cannot remove '${n}': ${e(i)}
`,p=1}}return{stdout:d,stderr:f,exitCode:p}}},a={name:`rm`,flags:[{flag:`-r`,type:`boolean`},{flag:`-R`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-v`,type:`boolean`}],needsArgs:!0};export{i as n,a as t};
//# sourceMappingURL=chunk-MIZPJHVH-BD7tHmLL.mjs.map