Files
QR-master/.output/server/node_modules/just-bash/dist/bundle/chunks/chunk-UIJUTQPH.js
2026-07-15 18:08:51 +02:00

4 lines
806 B
JavaScript

import{createRequire} from"node:module";const require=createRequire(import.meta.url);
import{a as i,b as l}from"./chunk-QAYAQNCG.js";var p={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},h="BASH_HISTORY",m={name:"history",async execute(e,s){if(l(e))return i(p);let a=s.env.get(h)||"[]",t;try{t=JSON.parse(a)}catch{t=[]}if(e[0]==="-c")return s.env.set(h,"[]"),{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}}},u={name:"history",flags:[{flag:"-c",type:"boolean"}]};export{m as a,u as b};