import{r as e,t}from"./chunk-74CEPOFO-V0JXh91S.mjs";var n={name:`history`,summary:`display command history`,usage:`history [n]`,options:[`-c      clear the history list`,`    --help display this help and exit`]},r=`BASH_HISTORY`,i={name:`history`,async execute(i,a){if(t(i))return e(n);let o=a.env.get(r)||`[]`,s;try{s=JSON.parse(o)}catch{s=[]}if(i[0]===`-c`)return a.env.set(r,`[]`),{stdout:``,stderr:``,exitCode:0};let c=s.length;i[0]&&/^\d+$/.test(i[0])&&(c=Math.min(parseInt(i[0],10),s.length));let l=s.length-c,u=``;for(let e=l;e<s.length;e++){let t=(e+1).toString().padStart(5,` `);u+=`${t}  ${s[e]}
`}return{stdout:u,stderr:``,exitCode:0}}},a={name:`history`,flags:[{flag:`-c`,type:`boolean`}]};export{a as n,i as t};
//# sourceMappingURL=chunk-NCNPKYJZ-Ct0_l0YT.mjs.map