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