import{a as r,b as d}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var u={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:["    --help display this help and exit"]},o="BASH_ALIAS_",m={name:"alias",async execute(e,a){if(d(e))return r(u);if(e.length===0){let t="";for(let[i,s]of a.env)if(i.startsWith(o)){let n=i.slice(o.length);t+=`alias ${n}='${s}'
`}return{stdout:t,stderr:"",exitCode:0}}let l=e[0]==="--"?e.slice(1):e;for(let t of l){let i=t.indexOf("=");if(i===-1){let s=o+t;return a.env.get(s)?{stdout:`alias ${t}='${a.env.get(s)}'
`,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${t}: not found
`,exitCode:1}}else{let s=t.slice(0,i),n=t.slice(i+1);(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))&&(n=n.slice(1,-1)),a.env.set(o+s,n)}}return{stdout:"",stderr:"",exitCode:0}}},c={name:"unalias",async execute(e,a){if(d(e))return r({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a      remove all aliases","    --help display this help and exit"]});if(e.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...]
`,exitCode:1};if(e[0]==="-a"){for(let s of a.env.keys())s.startsWith(o)&&a.env.delete(s);return{stdout:"",stderr:"",exitCode:0}}let l=e[0]==="--"?e.slice(1):e,t=!1,i="";for(let s of l){let n=o+s;a.env.get(n)?a.env.delete(n):(i+=`unalias: ${s}: not found
`,t=!0)}return{stdout:"",stderr:i,exitCode:t?1:0}}};export{m as aliasCommand,c as unaliasCommand};
