var p=(s,e,o)=>new Promise((i,n)=>{var u=t=>{try{c(o.next(t))}catch(l){n(l)}},h=t=>{try{c(o.throw(t))}catch(l){n(l)}},c=t=>t.done?i(t.value):Promise.resolve(t.value).then(u,h);c((o=o.apply(s,e)).next())});var r="~/.tldrc/tldr",f=`${r}/pages/android/`,x=`${r}/pages/common/`,m=`${r}/pages/linux/`,g=`${r}/pages/osx/`,d=`${r}/pages/sunos/`,w=`${r}/pages/windows/`,a=new RegExp(/^.*\.md$/),S={custom:(s,e,o)=>p(void 0,null,function*(){let{stdout:i}=yield e({command:"ls",args:["-Al",...[f,x,m,g,d,w].map(n=>n.replace(/^~/,o.environmentVariables.HOME))]});return i.split(`
`).filter(n=>a.test(n)).map(n=>({name:n.split(" ").at(-1).slice(0,-3),description:"Tldr page",icon:"fig://icon?type=string"}))})},$={script:["bash","-c",`command ls -Al ${m} 2>/dev/null`],postProcess:s=>s.split(`
`).filter(e=>a.test(e)).map(e=>({name:e.split(" ").at(-1).slice(0,-3),description:"Tldr page",icon:"fig://icon?type=string"}))},y={script:["bash","-c",`command ls -l ${g} 2>/dev/null`],postProcess:s=>s.split(`
`).filter(e=>a.test(e)).map(e=>({name:e.split(" ").at(-1).slice(0,-3),description:"Tldr page",icon:"fig://icon?type=string"}))},T={script:["bash","-c",`command ls -l ${d} 2>/dev/null`],postProcess:s=>s.split(`
`).filter(e=>a.test(e)).map(e=>({name:e.split(" ").at(-1).slice(0,-3),description:"Tldr page",icon:"fig://icon?type=string"}))},P=["linux","osx","sunos","windows","common"],F={name:"tldr",description:"A simpler man page than the existing man page",args:{generators:S},options:[{name:["-h","--help"],description:"Display help for command"},{name:["-s","--search"],description:"Search all pages for the query",args:{name:"query"}},{name:"--linux",description:"Show command page for Linux",args:{generators:$}},{name:"--osx",description:"Show command page for OSX",args:{generators:y}},{name:"--sunos",description:"Show command page for SunOS",args:{generators:T}},{name:["-l","--list"],description:"Show all pages for current platform"},{name:["-u","--update"],description:"Download the latest pages and generate search index"},{name:["-c","--clear-cache"],description:"Delete the entire local cache"},{name:["--platform","-p"],description:"Select platform",args:{name:"platform",suggestions:P}}]},v=F;export{v as default};
