import{r as e,t}from"./chunk-74CEPOFO-V0JXh91S.mjs";import{t as n}from"./chunk-HWKDQ44K-BJxdK4fT.mjs";var r={name:`which`,summary:`locate a command`,usage:`which [-as] program ...`,options:[`-a         List all instances of executables found`,`-s         No output, just return 0 if found, 1 if not`,`--help     display this help and exit`]},i={showAll:{short:`a`,type:`boolean`},silent:{short:`s`,type:`boolean`}},a={name:`which`,async execute(a,o){if(t(a))return e(r);let s=n(`which`,a,i);if(!s.ok)return s.error;let c=s.result.flags.showAll,l=s.result.flags.silent,u=s.result.positional;if(u.length===0)return{stdout:``,stderr:``,exitCode:1};let d=(o.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`),f=``,p=!0;for(let e of u){let t=!1;for(let n of d){if(!n)continue;let r=o.fs.resolvePath(n,e);if(await o.fs.exists(r)&&(t=!0,l||(f+=`${r}
`),!c))break}t||(p=!1)}return{stdout:f,stderr:``,exitCode:p?0:1}}},o={name:`which`,flags:[{flag:`-a`,type:`boolean`},{flag:`-s`,type:`boolean`}],needsArgs:!0};export{o as n,a as t};
//# sourceMappingURL=chunk-A65PWWJC-GGt9898w.mjs.map