import{r as e,t}from"./chunk-74CEPOFO-V0JXh91S.mjs";var n={name:`basename`,summary:`strip directory and suffix from filenames`,usage:`basename NAME [SUFFIX]
basename OPTION... NAME...`,options:[`-a, --multiple   support multiple arguments`,`-s, --suffix=SUFFIX  remove a trailing SUFFIX`,`    --help       display this help and exit`]},r={name:`basename`,async execute(r,i){if(t(r))return e(n);let a=!1,o=``,s=[];for(let e=0;e<r.length;e++){let t=r[e];t===`-a`||t===`--multiple`?a=!0:t===`-s`&&e+1<r.length?(o=r[++e],a=!0):t.startsWith(`--suffix=`)?(o=t.slice(9),a=!0):t.startsWith(`-`)||s.push(t)}if(s.length===0)return{stdout:``,stderr:`basename: missing operand
`,exitCode:1};!a&&s.length>=2&&(o=s.pop()??``);let c=[];for(let e of s){let t=e.replace(/\/+$/,``),n=t.split(`/`).pop()||t;o&&n.endsWith(o)&&(n=n.slice(0,-o.length)),c.push(n)}return{stdout:`${c.join(`
`)}
`,stderr:``,exitCode:0}}},i={name:`basename`,flags:[{flag:`-a`,type:`boolean`},{flag:`-s`,type:`value`,valueHint:`string`}],needsArgs:!0};export{i as n,r as t};
//# sourceMappingURL=chunk-ALLTKNUZ-4H3OLfNN.mjs.map