gitpick 4.6.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`?t.slice(0,t.at(-2)==="\r"?-2:-1):t;var
|
|
4
|
-
for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{let{[r]:f}=yield new v(t.nodeChildProcess);if(!f)return;let d="";try{for(var i=N(f.iterator({destroyOnReturn:!1})),a,c,p;a=!(c=yield new v(i.next())).done;a=!1){let x=c.value;let h=`${d}${x}`.split(/\r?\n/);d=h.pop(),yield*ht(h)}}catch(c){p=[c]}finally{try{a&&(c=i.return)&&(yield new v(c.call(i)))}finally{if(p)throw p[0]}}d&&(yield d)}finally{yield new v(t)}})},At=function(...t){return z(this,null,function*(){try{let e=[];for(;t.length>0;){e=t.map((i,a)=>{var c;return(c=e[a])!=null?c:Qe(i)});let[{value:r,done:o},n]=yield new v(Promise.race(e.map((i,a)=>Promise.all([i,a])))),[s]=t.splice(n,1);e.splice(n,1),o||(t.push(s),yield r)}}finally{yield new v(Promise.all(t.map(e=>e.return())))}})},Qe=async t=>{try{return await t.next()}catch(e){await t.throw(e)}};function T(t,e,r,o){let[n=[],s={}]=Array.isArray(e)?[e,r]:[[],e],i=gt([t,...n]),a=bt(s),c=Ot(t,n,a,i),p=Et(c,a,i);Object.assign(p,{nodeChildProcess:c}),p=o?It([o,p]):p;let f=ot(p,i,"stdout"),d=ot(p,i,"stderr");return Object.assign(p,{nodeChildProcess:c,stdout:f,stderr:d,[Symbol.asyncIterator]:()=>At(f,d),pipe:(x,h,D)=>T(x,h,D,p)})}var nt={};mt(nt,{bgBlack:()=>fr,bgBlue:()=>wr,bgBlueBright:()=>Pr,bgCyan:()=>xr,bgCyanBright:()=>jr,bgGray:()=>$r,bgGreen:()=>dr,bgGreenBright:()=>Ir,bgMagenta:()=>br,bgMagentaBright:()=>Br,bgRed:()=>hr,bgRedBright:()=>Or,bgWhite:()=>yr,bgWhiteBright:()=>Mr,bgYellow:()=>gr,bgYellowBright:()=>Ar,black:()=>cr,blue:()=>lr,blueBright:()=>kr,bold:()=>y,cyan:()=>w,cyanBright:()=>Cr,dim:()=>er,gray:()=>mr,green:()=>$,greenBright:()=>Tr,hidden:()=>ir,inverse:()=>sr,italic:()=>rr,magenta:()=>pr,magentaBright:()=>Rr,overline:()=>nr,red:()=>U,redBright:()=>vr,reset:()=>tr,strikethrough:()=>ar,underline:()=>or,white:()=>ur,whiteBright:()=>Sr,yellow:()=>I,yellowBright:()=>Er});import Xe from"node:tty";var Pt,Bt,G,jt,Mt,Ze=(Mt=(jt=(G=(Bt=(Pt=Xe)==null?void 0:Pt.WriteStream)==null?void 0:Bt.prototype)==null?void 0:G.hasColors)==null?void 0:jt.call(G))!=null?Mt:!1,l=(t,e)=>{if(!Ze)return n=>n;let r=`\x1B[${t}m`,o=`\x1B[${e}m`;return n=>{let s=n+"",i=s.indexOf(o);if(i===-1)return r+s+o;let a=r,c=0;for(;i!==-1;)a+=s.slice(c,i)+r,c=i+o.length,i=s.indexOf(o,c);return a+=s.slice(c)+o,a}},tr=l(0,0),y=l(1,22),er=l(2,22),rr=l(3,23),or=l(4,24),nr=l(53,55),sr=l(7,27),ir=l(8,28),ar=l(9,29),cr=l(30,39),U=l(31,39),$=l(32,39),I=l(33,39),lr=l(34,39),pr=l(35,39),w=l(36,39),ur=l(37,39),mr=l(90,39),fr=l(40,49),hr=l(41,49),dr=l(42,49),gr=l(43,49),wr=l(44,49),br=l(45,49),xr=l(46,49),yr=l(47,49),$r=l(100,49),vr=l(91,39),Tr=l(92,39),Er=l(93,39),kr=l(94,39),Rr=l(95,39),Cr=l(96,39),Sr=l(97,39),Or=l(101,49),Ir=l(102,49),Ar=l(103,49),Pr=l(104,49),Br=l(105,49),jr=l(106,49),Mr=l(107,49);var H=async(t,e,r)=>{process.platform==="win32"&&await T("git",["config","--global","core.longpaths","true"]);let o=`https://${t.token?t.token+"@":t.token}github.com/${t.owner}/${t.repository}.git`,n=Lt.resolve(Lr.tmpdir(),`${t.repository}-${Date.now()}${Math.random().toString(16).slice(2,6)}`);e.watch||console.log(`${$("\u2714")} Picking ${t.type}${t.type==="repository"?" without .git":" from repository"}...`);let s=performance.now();try{await T("git",["clone",o,n,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(c){console.log(`${$("\u2714")} Using robust checkout process...`),await T("git",["clone",o,n,...e.recursive?["--recursive"]:[]]),await T("git",["checkout",t.branch],{cwd:n})}let i=Lt.resolve(n,t.path);(await B.promises.stat(i)).isDirectory()?(await B.promises.mkdir(r,{recursive:!0}),await X(i,r)):(await B.promises.mkdir(r.split("/").slice(0,-1).join("/"),{recursive:!0}),await B.promises.copyFile(i,r)),e.watch?console.log("- Synced at "+new Date().toLocaleTimeString()):console.log(`${$("\u2714")} Picked ${t.type}${t.type==="repository"?" without .git":" from repository"} in ${((performance.now()-s)/1e3).toFixed(2)} seconds.`),await B.promises.rm(n,{recursive:!0,force:!0})};function st(t){if(typeof t=="number"||/^\d+$/.test(t))return typeof t=="number"?t:parseInt(t,10);let e=/(\d+)([hms])/g,r=0,o;for(;(o=e.exec(t))!==null;){let n=parseInt(o[1],10);switch(o[2]){case"h":r+=n*36e5;break;case"m":r+=n*6e4;break;case"s":r+=n*1e3;break}}return r}var _t=async t=>{var n,s;let e=(await T("git",["ls-remote",t])).stdout,r=(n=e.match(/(.+)\s+HEAD/))==null?void 0:n[1],o=(s=e.match(new RegExp(`${r}\\s+refs/heads/(.+)`)))==null?void 0:s[1];if(!o)throw new Error("Could not determine default branch!");return o};async function Wt(t,{branch:e,target:r}){let o=/^https:\/\/([^@]+)@github\.com/,n=t.match(o),s="";n&&(s=n[1],t=t.replace(o,"https://github.com"));let i=["git@github.com:","https://github.com/","https://raw.githubusercontent.com/"];for(let D of i)if(t.startsWith(D)){t=t.replace(D,"");break}let a=t.split("/"),c=a[0],p=a[1].endsWith(".git")?a[1].slice(0,-4):a[1],f=a[2]==="blob"?"blob":a[2]==="tree"?"tree":a[2]+a[3]==="refsheads"?"raw":"repository",d=e||(f==="repository"?await _t(`https://${s&&s+"@"}github.com/${c}/${p}`):f==="raw"?a[4]:a[3]),x=f?f==="raw"?a.slice(5).join("/"):a.slice(4).join("/"):a.slice(2).join("/")||"/",h=r||(f==="blob"?".":x.split("/").pop()||p);return{token:s,owner:c,repository:p,type:f,branch:d,path:x,target:h}}var _={};mt(_,{beep:()=>co,clearScreen:()=>no,clearTerminal:()=>so,cursorBackward:()=>Ur,cursorDown:()=>Nr,cursorForward:()=>Gr,cursorGetPosition:()=>Yr,cursorHide:()=>qr,cursorLeft:()=>be,cursorMove:()=>Fr,cursorNextLine:()=>Jr,cursorPrevLine:()=>Kr,cursorRestorePosition:()=>Vr,cursorSavePosition:()=>Hr,cursorShow:()=>zr,cursorTo:()=>Dr,cursorUp:()=>we,enterAlternativeScreen:()=>io,eraseDown:()=>to,eraseEndLine:()=>Xr,eraseLine:()=>xe,eraseLines:()=>Qr,eraseScreen:()=>it,eraseStartLine:()=>Zr,eraseUp:()=>eo,exitAlternativeScreen:()=>ao,iTerm:()=>uo,image:()=>po,link:()=>lo,scrollDown:()=>oo,scrollUp:()=>ro});import at from"node:process";var Dt,V=((Dt=globalThis.window)==null?void 0:Dt.document)!==void 0,Ft,Nt,Rn=((Nt=(Ft=globalThis.process)==null?void 0:Ft.versions)==null?void 0:Nt.node)!==void 0,Gt,Ut,Cn=((Ut=(Gt=globalThis.process)==null?void 0:Gt.versions)==null?void 0:Ut.bun)!==void 0,Ht,Vt,Sn=((Vt=(Ht=globalThis.Deno)==null?void 0:Ht.version)==null?void 0:Vt.deno)!==void 0,Yt,Jt,On=((Jt=(Yt=globalThis.process)==null?void 0:Yt.versions)==null?void 0:Jt.electron)!==void 0,Kt,qt,In=((qt=(Kt=globalThis.navigator)==null?void 0:Kt.userAgent)==null?void 0:qt.includes("jsdom"))===!0,An=typeof WorkerGlobalScope!="undefined"&&globalThis instanceof WorkerGlobalScope,Pn=typeof DedicatedWorkerGlobalScope!="undefined"&&globalThis instanceof DedicatedWorkerGlobalScope,Bn=typeof SharedWorkerGlobalScope!="undefined"&&globalThis instanceof SharedWorkerGlobalScope,jn=typeof ServiceWorkerGlobalScope!="undefined"&&globalThis instanceof ServiceWorkerGlobalScope,zt,Qt,j=(Qt=(zt=globalThis.navigator)==null?void 0:zt.userAgentData)==null?void 0:Qt.platform,Xt,Zt,te,ee,Mn=j==="macOS"||((Xt=globalThis.navigator)==null?void 0:Xt.platform)==="MacIntel"||((te=(Zt=globalThis.navigator)==null?void 0:Zt.userAgent)==null?void 0:te.includes(" Mac "))===!0||((ee=globalThis.process)==null?void 0:ee.platform)==="darwin",re,oe,Ln=j==="Windows"||((re=globalThis.navigator)==null?void 0:re.platform)==="Win32"||((oe=globalThis.process)==null?void 0:oe.platform)==="win32",ne,se,ie,ae,ce,_n=j==="Linux"||((se=(ne=globalThis.navigator)==null?void 0:ne.platform)==null?void 0:se.startsWith("Linux"))===!0||((ae=(ie=globalThis.navigator)==null?void 0:ie.userAgent)==null?void 0:ae.includes(" Linux "))===!0||((ce=globalThis.process)==null?void 0:ce.platform)==="linux",le,pe,ue,Wn=j==="iOS"||((le=globalThis.navigator)==null?void 0:le.platform)==="MacIntel"&&((pe=globalThis.navigator)==null?void 0:pe.maxTouchPoints)>1||/iPad|iPhone|iPod/.test((ue=globalThis.navigator)==null?void 0:ue.platform),me,fe,he,de,Dn=j==="Android"||((me=globalThis.navigator)==null?void 0:me.platform)==="Android"||((he=(fe=globalThis.navigator)==null?void 0:fe.userAgent)==null?void 0:he.includes(" Android "))===!0||((de=globalThis.process)==null?void 0:de.platform)==="android";var u="\x1B[",L="\x1B]",A="\x07",M=";",ge=!V&&at.env.TERM_PROGRAM==="Apple_Terminal",_r=!V&&at.platform==="win32",Wr=V?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:at.cwd,Dr=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?u+(t+1)+"G":u+(e+1)+M+(t+1)+"H"},Fr=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=u+-t+"D":t>0&&(r+=u+t+"C"),e<0?r+=u+-e+"A":e>0&&(r+=u+e+"B"),r},we=(t=1)=>u+t+"A",Nr=(t=1)=>u+t+"B",Gr=(t=1)=>u+t+"C",Ur=(t=1)=>u+t+"D",be=u+"G",Hr=ge?"\x1B7":u+"s",Vr=ge?"\x1B8":u+"u",Yr=u+"6n",Jr=u+"E",Kr=u+"F",qr=u+"?25l",zr=u+"?25h",Qr=t=>{let e="";for(let r=0;r<t;r++)e+=xe+(r<t-1?we():"");return t&&(e+=be),e},Xr=u+"K",Zr=u+"1K",xe=u+"2K",to=u+"J",eo=u+"1J",it=u+"2J",ro=u+"S",oo=u+"T",no="\x1Bc",so=_r?`${it}${u}0f`:`${it}${u}3J${u}H`,io=u+"?1049h",ao=u+"?1049l",co=A,lo=(t,e)=>[L,"8",M,M,e,A,t,L,"8",M,M,A].join(""),po=(t,e={})=>{let r=`${L}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+Buffer.from(t).toString("base64")+A},uo={setCwd:(t=Wr())=>`${L}50;CurrentDir=${t}${A}`,annotation(t,e={}){let r=`${L}1337;`,o=e.x!==void 0,n=e.y!==void 0;if((o||n)&&!(o&&n&&e.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replaceAll("|",""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(o?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+A}};import W from"node:process";import ct from"node:process";import mo from"node:os";import ye from"node:tty";function b(t,e=globalThis.Deno?globalThis.Deno.args:ct.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),n=e.indexOf("--");return o!==-1&&(n===-1||o<n)}var{env:m}=ct,Y;b("no-color")||b("no-colors")||b("color=false")||b("color=never")?Y=0:(b("color")||b("colors")||b("color=true")||b("color=always"))&&(Y=1);function fo(){if(!("FORCE_COLOR"in m))return;if(m.FORCE_COLOR==="true")return 1;if(m.FORCE_COLOR==="false")return 0;if(m.FORCE_COLOR.length===0)return 1;let t=Math.min(Number.parseInt(m.FORCE_COLOR,10),3);if([0,1,2,3].includes(t))return t}function ho(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function go(t,{streamIsTTY:e,sniffFlags:r=!0}={}){let o=fo();o!==void 0&&(Y=o);let n=r?Y:o;if(n===0)return 0;if(r){if(b("color=16m")||b("color=full")||b("color=truecolor"))return 3;if(b("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(t&&!e&&n===void 0)return 0;let s=n||0;if(m.TERM==="dumb")return s;if(ct.platform==="win32"){let i=mo.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(i=>i in m)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(i=>i in m)||m.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if(m.COLORTERM==="truecolor"||m.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in m){let i=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:s}function J(t,e={}){let r=go(t,g({streamIsTTY:t&&t.isTTY},e));return ho(r)}var Kn={stdout:J({isTTY:ye.isatty(1)}),stderr:J({isTTY:ye.isatty(2)})};import wo from"process";function E(t,e=wo.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),n=e.indexOf("--");return o!==-1&&(n===-1||o<n)}function $e(t=""){var r;if(/^\d{3,4}$/.test(t)){let o=(r=/(\d{1,2})(\d{2})/.exec(t))!=null?r:[];return{major:0,minor:Number.parseInt(o[1],10),patch:Number.parseInt(o[2],10)}}let e=(t!=null?t:"").split(".").map(o=>Number.parseInt(o,10));return{major:e[0],minor:e[1],patch:e[2]}}function ve(t){let{CI:e,FORCE_HYPERLINK:r,NETLIFY:o,TEAMCITY_VERSION:n,TERM_PROGRAM:s,TERM_PROGRAM_VERSION:i,VTE_VERSION:a,TERM:c}=W.env;if(r)return!(r.length>0&&Number.parseInt(r,10)===0);if(E("no-hyperlink")||E("no-hyperlinks")||E("hyperlink=false")||E("hyperlink=never"))return!1;if(E("hyperlink=true")||E("hyperlink=always")||o)return!0;if(!J(t)||t&&!t.isTTY)return!1;if("WT_SESSION"in W.env)return!0;if(W.platform==="win32"||e||n)return!1;if(s){let p=$e(i);switch(s){case"iTerm.app":return p.major===3?p.minor>=1:p.major>3;case"WezTerm":return p.major>=20200620;case"vscode":return p.major>1||p.major===1&&p.minor>=72;case"ghostty":return!0}}if(a){if(a==="0.50.0")return!1;let p=$e(a);return p.major>0||p.minor>=50}switch(c){case"alacritty":return!0}return!1}var bo={stdout:ve(W.stdout),stderr:ve(W.stderr)},K=bo;function k(t,e,n={}){var s=n,{target:r="stdout"}=s,o=P(s,["target"]);return K[r]?_.link(t,e):o.fallback===!1?t:typeof o.fallback=="function"?o.fallback(t,e):`${t} (\u200B${e}\u200B)`}k.isSupported=K.stdout;k.stderr=(t,e,r={})=>k(t,e,g({target:"stderr"},r));k.stderr.isSupported=K.stderr;var Ee="gitpick",ke="4.6.0";var $o=`
|
|
5
|
-
|
|
2
|
+
var Mt=Object.defineProperty,nr=Object.defineProperties;var ir=Object.getOwnPropertyDescriptors;var at=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var D=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),bt=t=>{throw TypeError(t)};var wt=(t,e,r)=>e in t?Mt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,y=(t,e)=>{for(var r in e||(e={}))jt.call(e,r)&&wt(t,r,e[r]);if(at)for(var r of at(e))Lt.call(e,r)&&wt(t,r,e[r]);return t},L=(t,e)=>nr(t,ir(e));var q=(t,e)=>{var r={};for(var o in t)jt.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&at)for(var o of at(t))e.indexOf(o)<0&&Lt.call(t,o)&&(r[o]=t[o]);return r};var Gt=(t,e)=>{for(var r in e)Mt(t,r,{get:e[r],enumerable:!0})};var Wt=(t,e,r)=>wt(t,typeof e!="symbol"?e+"":e,r),xt=(t,e,r)=>e.has(t)||bt("Cannot "+r);var u=(t,e,r)=>(xt(t,e,"read from private field"),r?r.call(t):e.get(t)),T=(t,e,r)=>e.has(t)?bt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),w=(t,e,r,o)=>(xt(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r),b=(t,e,r)=>(xt(t,e,"access private method"),r);var _t=(t,e,r,o)=>({set _(s){w(t,e,s,r)},get _(){return u(t,e,o)}});var I=function(t,e){this[0]=t,this[1]=e},yt=(t,e,r)=>{var o=(i,a,c,p)=>{try{var d=r[i](a),x=(a=d.value)instanceof I,E=d.done;Promise.resolve(x?a[0]:a).then(g=>x?o(i==="return"?i:"next",a[1]?{done:g.done,value:g.value}:g,c,p):c({value:g,done:E})).catch(g=>o("throw",g,c,p))}catch(g){p(g)}},s=i=>n[i]=a=>new Promise((c,p)=>o(i,a,c,p)),n={};return r=r.apply(t,e),n[D("asyncIterator")]=()=>n,s("next"),s("throw"),s("return"),n},Nt=t=>{var e=t[D("asyncIterator")],r=!1,o,s={};return e==null?(e=t[D("iterator")](),o=n=>s[n]=i=>e[n](i)):(e=e.call(t),o=n=>s[n]=i=>{if(r){if(r=!1,n==="throw")throw i;return i}return r=!0,{done:!1,value:new I(new Promise(a=>{var c=e[n](i);c instanceof Object||bt("Object expected"),a(c)}),1)}}),s[D("iterator")]=()=>s,o("next"),"throw"in e?o("throw"):s.throw=n=>{throw n},"return"in e&&o("return"),s},ct=(t,e,r)=>(e=t[D("asyncIterator")])?e.call(t):(t=t[D("iterator")](),e={},r=(o,s)=>(s=t[o])&&(e[o]=n=>new Promise((i,a,c)=>(n=s.call(t,n),c=n.done,Promise.resolve(n.value).then(p=>i({value:p,done:c}),a)))),r("next"),r("return"),e);import sr from"node:fs";import os from"node:path";import{parseArgs as ss}from"node:util";import tt from"node:fs";import To from"node:os";import fe from"node:path";import Tt from"node:fs";import Ft from"node:path";var vt=async(t,e)=>{let r=await Tt.promises.readdir(t,{withFileTypes:!0});await Tt.promises.mkdir(e,{recursive:!0});for(let o of r){if(o.name===".git")continue;let s=Ft.join(t,o.name),n=Ft.join(e,o.name);o.isDirectory()?await vt(s,n):await Tt.promises.copyFile(s,n)}};import ar from"node:process";import{stripVTControlCharacters as cr}from"node:util";var Dt=t=>({start:ar.hrtime.bigint(),command:t.map(e=>lr(cr(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),lr=t=>/[^\w./-]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t;import H from"node:path";import{fileURLToPath as pr}from"node:url";import Ht from"node:process";var Ut=c=>{var p=c,{stdin:t,stdout:e,stderr:r,stdio:o=[t,e,r],env:s,preferLocal:n,cwd:i="."}=p,a=q(p,["stdin","stdout","stderr","stdio","env","preferLocal","cwd"]);var g;let d=i instanceof URL?pr(i):H.resolve(i),x=s?y(y({},Ht.env),s):void 0,E=(g=o[0])==null?void 0:g.string;return L(y({},a),{input:E,stdio:E===void 0?o:["pipe",...o.slice(1)],env:n?ur(x!=null?x:Ht.env,d):x,cwd:d})},ur=(s,o)=>{var n=s,{Path:t="",PATH:e=t}=n,r=q(n,["Path","PATH"]);let i=e.split(H.delimiter),a=Vt([],H.resolve(o)).map(c=>H.join(c,"node_modules/.bin")).filter(c=>!i.includes(c));return L(y({},r),{PATH:[...a,e].filter(Boolean).join(H.delimiter)})},Vt=(t,e)=>t.at(-1)===e?t:Vt([...t,e],H.resolve(e,".."));import{spawn as $r}from"node:child_process";import{once as Er}from"node:events";import Zt from"node:process";import{stat as hr}from"node:fs/promises";import Yt from"node:path";import Jt from"node:process";var Kt=async(t,e,r)=>await mr(t,r)?[Et(t),e.map(o=>gr(o)),L(y({},r),{shell:!0})]:[t,e,r],mr=async(t,{shell:e,cwd:r,env:o=Jt.env})=>Jt.platform==="win32"&&!e&&!await fr(t,r,o),fr=async(t,e,{Path:r="",PATH:o=r})=>{var s,n;return qt.some(i=>t.toLowerCase().endsWith(i))||((n=$t[s=`${t}\0${e}\0${o}`])!=null?n:$t[s]=await dr(t,e,o))},$t={},dr=async(t,e,r)=>{let o=r.split(Yt.delimiter).filter(Boolean).map(s=>s.replace(/^"(.*)"$/,"$1"));try{await Promise.all(qt.flatMap(s=>[e,...o].map(n=>`${Yt.resolve(n,t)}${s}`)).map(async s=>{try{await hr(s)}catch(n){return}throw 0}))}catch(s){return!0}return!1},qt=[".exe",".com"],gr=t=>Et(Et(`"${t.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),Et=t=>t.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1");import{once as wr,on as br}from"node:events";import xr from"node:process";var zt=async(t,{input:e},r)=>{let o=await t;e!==void 0&&o.stdin.end(e);let s=wr(o,"close");try{return await Promise.race([s,...o.stdio.filter(Boolean).map(n=>yr(n))]),Tr(r,Qt(o)),Xt(r)}catch(n){throw await Promise.allSettled([s]),kt(n,o,r)}},yr=async t=>{try{for(var e=ct(br(t,"error")),r,o,s;r=!(o=await e.next()).done;r=!1){let[n]=o.value;if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(n==null?void 0:n.code))throw n}}catch(o){s=[o]}finally{try{r&&(o=e.return)&&await o.call(e)}finally{if(s)throw s[0]}}},Tr=({command:t},{exitCode:e,signalName:r})=>{if(r!==void 0)throw new G(`Command was terminated with ${r}: ${t}`);if(e!==void 0)throw new G(`Command failed with exit code ${e}: ${t}`)},kt=(t,e,r)=>Object.assign(vr(t,r),Qt(e),Xt(r)),vr=(t,{command:e})=>t instanceof G?t:new G(`Command failed: ${e}`,{cause:t}),G=class extends Error{constructor(){super(...arguments);Wt(this,"name","SubprocessError")}},Qt=({exitCode:t,signalCode:e})=>y(y({},t<1?{}:{exitCode:t}),e===null?{}:{signalName:e}),Xt=({state:{stdout:t,stderr:e,output:r},command:o,start:s})=>({stdout:St(t),stderr:St(e),output:St(r),command:o,durationMs:Number(xr.hrtime.bigint()-s)/1e6}),St=t=>t.at(-1)===`
|
|
3
|
+
`?t.slice(0,t.at(-2)==="\r"?-2:-1):t;var ee=async(t,e,r,o)=>{try{[t,e]=["node","node.exe"].includes(t.toLowerCase())?[Zt.execPath,[...Zt.execArgv.filter(n=>!n.startsWith("--inspect")),...e]]:[t,e];let s=$r(...await Kt(t,e,r));return te(s.stdout,o,"stdout"),te(s.stderr,o,"stderr"),s.once("error",()=>{}),await Er(s,"spawn"),s}catch(s){throw kt(s,{},o)}},te=(t,{state:e},r)=>{t&&(t.setEncoding("utf8"),e.isIterating||(e.isIterating=!1,t.on("data",o=>{e[r]+=o,e.output+=o})))};import{pipeline as Sr}from"node:stream/promises";var re=async t=>{var o;let[[e,r]]=await Promise.all([Promise.allSettled(t),kr(t)]);if(r.reason)throw r.reason.pipedFrom=(o=e.reason)!=null?o:e.value,r.reason;if(e.reason)throw e.reason;return L(y({},r.value),{pipedFrom:e.value})},kr=async t=>{try{let[{stdout:e},{stdin:r}]=await Promise.all(t.map(({nodeChildProcess:o})=>o));if(r===null)throw new Error('The "stdin" option must be set on the first "spawn()" call in the pipeline.');if(e===null)throw new Error('The "stdout" option must be set on the last "spawn()" call in the pipeline.');Sr(e,r).catch(()=>{})}catch(e){throw await Promise.allSettled(t.map(({nodeChildProcess:r})=>Rr(r))),e}},Rr=async t=>{let{stdin:e}=await t;e.end()};var Rt=function(o,s,n){return yt(this,arguments,function*(t,{state:e},r){if(e.isIterating===!1)throw new Error(`The subprocess must be iterated right away, for example:
|
|
4
|
+
for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{let{[r]:d}=yield new I(t.nodeChildProcess);if(!d)return;let x="";try{for(var i=ct(d.iterator({destroyOnReturn:!1})),a,c,p;a=!(c=yield new I(i.next())).done;a=!1){let E=c.value;let g=`${x}${E}`.split(/\r?\n/);x=g.pop(),yield*Nt(g)}}catch(c){p=[c]}finally{try{a&&(c=i.return)&&(yield new I(c.call(i)))}finally{if(p)throw p[0]}}x&&(yield x)}finally{yield new I(t)}})},oe=function(...t){return yt(this,null,function*(){try{let e=[];for(;t.length>0;){e=t.map((i,a)=>{var c;return(c=e[a])!=null?c:Cr(i)});let[{value:r,done:o},s]=yield new I(Promise.race(e.map((i,a)=>Promise.all([i,a])))),[n]=t.splice(s,1);e.splice(s,1),o||(t.push(n),yield r)}}finally{yield new I(Promise.all(t.map(e=>e.return())))}})},Cr=async t=>{try{return await t.next()}catch(e){await t.throw(e)}};function O(t,e,r,o){let[s=[],n={}]=Array.isArray(e)?[e,r]:[[],e],i=Dt([t,...s]),a=Ut(n),c=ee(t,s,a,i),p=zt(c,a,i);Object.assign(p,{nodeChildProcess:c}),p=o?re([o,p]):p;let d=Rt(p,i,"stdout"),x=Rt(p,i,"stderr");return Object.assign(p,{nodeChildProcess:c,stdout:d,stderr:x,[Symbol.asyncIterator]:()=>oe(d,x),pipe:(E,g,it)=>O(E,g,it,p)})}import C from"node:process";import{stripVTControlCharacters as mo}from"node:util";var R={};Gt(R,{bgBlack:()=>Ur,bgBlue:()=>Kr,bgBlueBright:()=>lo,bgCyan:()=>zr,bgCyanBright:()=>uo,bgGray:()=>Xr,bgGreen:()=>Yr,bgGreenBright:()=>ao,bgMagenta:()=>qr,bgMagentaBright:()=>po,bgRed:()=>Vr,bgRedBright:()=>io,bgWhite:()=>Qr,bgWhiteBright:()=>ho,bgYellow:()=>Jr,bgYellowBright:()=>co,black:()=>_r,blue:()=>Nr,blueBright:()=>ro,bold:()=>S,cyan:()=>v,cyanBright:()=>so,dim:()=>Br,gray:()=>Hr,green:()=>W,greenBright:()=>to,hidden:()=>Gr,inverse:()=>Lr,italic:()=>Pr,magenta:()=>Fr,magentaBright:()=>oo,overline:()=>jr,red:()=>pt,redBright:()=>Zr,reset:()=>Ar,strikethrough:()=>Wr,underline:()=>Mr,white:()=>Dr,whiteBright:()=>no,yellow:()=>U,yellowBright:()=>eo});import Ir from"node:tty";var se,ne,lt,ie,ae,Or=(ae=(ie=(lt=(ne=(se=Ir)==null?void 0:se.WriteStream)==null?void 0:ne.prototype)==null?void 0:lt.hasColors)==null?void 0:ie.call(lt))!=null?ae:!1,l=(t,e)=>{if(!Or)return s=>s;let r=`\x1B[${t}m`,o=`\x1B[${e}m`;return s=>{let n=s+"",i=n.indexOf(o);if(i===-1)return r+n+o;let a=r,c=0;for(;i!==-1;)a+=n.slice(c,i)+r,c=i+o.length,i=n.indexOf(o,c);return a+=n.slice(c)+o,a}},Ar=l(0,0),S=l(1,22),Br=l(2,22),Pr=l(3,23),Mr=l(4,24),jr=l(53,55),Lr=l(7,27),Gr=l(8,28),Wr=l(9,29),_r=l(30,39),pt=l(31,39),W=l(32,39),U=l(33,39),Nr=l(34,39),Fr=l(35,39),v=l(36,39),Dr=l(37,39),Hr=l(90,39),Ur=l(40,49),Vr=l(41,49),Yr=l(42,49),Jr=l(43,49),Kr=l(44,49),qr=l(45,49),zr=l(46,49),Qr=l(47,49),Xr=l(100,49),Zr=l(91,39),to=l(92,39),eo=l(93,39),ro=l(94,39),oo=l(95,39),so=l(96,39),no=l(97,39),io=l(101,49),ao=l(102,49),co=l(103,49),lo=l(104,49),po=l(105,49),uo=l(106,49),ho=l(107,49);var Z=C.platform!=="win32"||!!C.env.WT_SESSION,fo=t=>!!(t.isTTY&&C.env.TERM!=="dumb"&&!("CI"in C.env)),go=R.blue(Z?"\u2139":"i"),wo=R.green(Z?"\u2714":"\u221A"),bo=R.yellow(Z?"\u26A0":"\u203C"),xo=R.red(Z?"\u2716\uFE0F":"\xD7"),yo={frames:Z?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"],interval:80},V,Y,_,N,A,k,F,J,P,B,X,m,z,Q,ut,ce,le,pe,ue,he,me,Ct=class{constructor(e={}){T(this,m);T(this,V);T(this,Y);T(this,_,-1);T(this,N);T(this,A);T(this,k);T(this,F);T(this,J,0);T(this,P);T(this,B);T(this,X,0);var o,s,n,i;let r=(o=e.spinner)!=null?o:yo;w(this,V,r.frames),w(this,Y,r.interval),w(this,A,(s=e.text)!=null?s:""),w(this,k,(n=e.stream)!=null?n:C.stderr),w(this,F,(i=e.color)!=null?i:"cyan"),w(this,B,fo(u(this,k))),w(this,P,b(this,m,me).bind(this))}start(e){return e&&w(this,A,e),this.isSpinning?this:(b(this,m,le).call(this),b(this,m,Q).call(this),b(this,m,ue).call(this),w(this,N,setInterval(()=>{b(this,m,Q).call(this)},u(this,Y))),this)}stop(e){return this.isSpinning?(clearInterval(u(this,N)),w(this,N,void 0),b(this,m,pe).call(this),this.clear(),b(this,m,he).call(this),e&&u(this,k).write(`${e}
|
|
5
|
+
`),this):this}success(e){return b(this,m,z).call(this,wo,e)}error(e){return b(this,m,z).call(this,xo,e)}warning(e){return b(this,m,z).call(this,bo,e)}info(e){return b(this,m,z).call(this,go,e)}get isSpinning(){return u(this,N)!==void 0}get text(){return u(this,A)}set text(e){w(this,A,e!=null?e:""),b(this,m,Q).call(this)}get color(){return u(this,F)}set color(e){w(this,F,e),b(this,m,Q).call(this)}clear(){if(!u(this,B))return this;u(this,k).cursorTo(0);for(let e=0;e<u(this,J);e++)e>0&&u(this,k).moveCursor(0,-1),u(this,k).clearLine(1);return w(this,J,0),this}};V=new WeakMap,Y=new WeakMap,_=new WeakMap,N=new WeakMap,A=new WeakMap,k=new WeakMap,F=new WeakMap,J=new WeakMap,P=new WeakMap,B=new WeakMap,X=new WeakMap,m=new WeakSet,z=function(e,r){return this.stop(`${e} ${r!=null?r:u(this,A)}`)},Q=function(){var n;let e=Date.now();(u(this,_)===-1||e-u(this,X)>=u(this,Y))&&(w(this,_,++_t(this,_)._%u(this,V).length),w(this,X,e));let r=(n=R[u(this,F)])!=null?n:R.cyan,o=u(this,V)[u(this,_)],s=`${r(o)} ${u(this,A)}`;u(this,B)||(s+=`
|
|
6
|
+
`),this.clear(),b(this,m,ut).call(this,s),u(this,B)&&w(this,J,b(this,m,ce).call(this,s))},ut=function(e){u(this,k).write(e)},ce=function(e){var n;let r=(n=u(this,k).columns)!=null?n:80,o=mo(e).split(`
|
|
7
|
+
`),s=0;for(let i of o)s+=Math.max(1,Math.ceil(i.length/r));return s},le=function(){u(this,B)&&b(this,m,ut).call(this,"\x1B[?25l")},pe=function(){u(this,B)&&b(this,m,ut).call(this,"\x1B[?25h")},ue=function(){C.once("SIGINT",u(this,P)),C.once("SIGTERM",u(this,P))},he=function(){C.off("SIGINT",u(this,P)),C.off("SIGTERM",u(this,P))},me=function(e){this.isSpinning&&this.stop();let r=e==="SIGINT"?130:e==="SIGTERM"?143:1;C.exit(r)};function It(t){return new Ct(t)}var ht=async(t,e,r)=>{process.platform==="win32"&&await O("git",["config","--global","core.longpaths","true"]);let o=`https://${t.token?t.token+"@":t.token}github.com/${t.owner}/${t.repository}.git`,s=fe.resolve(To.tmpdir(),`${t.repository}-${Date.now()}${Math.random().toString(16).slice(2,6)}`),n=It(),i=performance.now();e.watch||n.start(`Picking ${t.type}${t.type==="repository"?" without .git":" from repository"}...`);try{await O("git",["clone",o,s,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(p){e.watch||n.info("Using robust checkout process..."),await O("git",["clone",o,s,...e.recursive?["--recursive"]:[]]),await O("git",["checkout",t.branch],{cwd:s})}let a=fe.resolve(s,t.path);(await tt.promises.stat(a)).isDirectory()?(await tt.promises.mkdir(r,{recursive:!0}),await vt(a,r)):(await tt.promises.mkdir(r.split("/").slice(0,-1).join("/"),{recursive:!0}),await tt.promises.copyFile(a,r)),e.watch?console.log("- Synced at "+new Date().toLocaleTimeString()):n.success(`Picked ${t.type}${t.type==="repository"?" without .git":" from repository"} in ${((performance.now()-i)/1e3).toFixed(2)} seconds.`),await tt.promises.rm(s,{recursive:!0,force:!0})};function Ot(t){if(typeof t=="number"||/^\d+$/.test(t))return typeof t=="number"?t:parseInt(t,10);let e=/(\d+)([hms])/g,r=0,o;for(;(o=e.exec(t))!==null;){let s=parseInt(o[1],10);switch(o[2]){case"h":r+=s*36e5;break;case"m":r+=s*6e4;break;case"s":r+=s*1e3;break}}return r}var de=async t=>{var s,n;let e=(await O("git",["ls-remote",t])).stdout,r=(s=e.match(/(.+)\s+HEAD/))==null?void 0:s[1],o=(n=e.match(new RegExp(`${r}\\s+refs/heads/(.+)`)))==null?void 0:n[1];if(!o)throw new Error("Could not determine default branch!");return o};async function ge(t,{branch:e,target:r}){let o=/^https:\/\/([^@]+)@github\.com/,s=t.match(o),n="";s&&(n=s[1],t=t.replace(o,"https://github.com"));let i=["git@github.com:","https://github.com/","https://raw.githubusercontent.com/"];for(let it of i)if(t.startsWith(it)){t=t.replace(it,"");break}let a=t.split("/"),c=a[0],p=a[1].endsWith(".git")?a[1].slice(0,-4):a[1],d=a[2]==="blob"?"blob":a[2]==="tree"?"tree":a[2]+a[3]==="refsheads"?"raw":"repository",x=e||(d==="repository"?await de(`https://${n&&n+"@"}github.com/${c}/${p}`):d==="raw"?a[4]:a[3]),E=d?d==="raw"?a.slice(5).join("/"):a.slice(4).join("/"):a.slice(2).join("/")||"/",g=r||(d==="blob"?".":E.split("/").pop()||p);return{token:n,owner:c,repository:p,type:d,branch:x,path:E,target:g}}var st={};Gt(st,{beep:()=>Jo,clearScreen:()=>Ho,clearTerminal:()=>Uo,cursorBackward:()=>Co,cursorDown:()=>ko,cursorForward:()=>Ro,cursorGetPosition:()=>Ao,cursorHide:()=>Mo,cursorLeft:()=>ze,cursorMove:()=>So,cursorNextLine:()=>Bo,cursorPrevLine:()=>Po,cursorRestorePosition:()=>Oo,cursorSavePosition:()=>Io,cursorShow:()=>jo,cursorTo:()=>Eo,cursorUp:()=>qe,enterAlternativeScreen:()=>Vo,eraseDown:()=>_o,eraseEndLine:()=>Go,eraseLine:()=>Qe,eraseLines:()=>Lo,eraseScreen:()=>At,eraseStartLine:()=>Wo,eraseUp:()=>No,exitAlternativeScreen:()=>Yo,iTerm:()=>zo,image:()=>qo,link:()=>Ko,scrollDown:()=>Do,scrollUp:()=>Fo});import Bt from"node:process";var we,mt=((we=globalThis.window)==null?void 0:we.document)!==void 0,be,xe,dn=((xe=(be=globalThis.process)==null?void 0:be.versions)==null?void 0:xe.node)!==void 0,ye,Te,gn=((Te=(ye=globalThis.process)==null?void 0:ye.versions)==null?void 0:Te.bun)!==void 0,ve,$e,wn=(($e=(ve=globalThis.Deno)==null?void 0:ve.version)==null?void 0:$e.deno)!==void 0,Ee,Se,bn=((Se=(Ee=globalThis.process)==null?void 0:Ee.versions)==null?void 0:Se.electron)!==void 0,ke,Re,xn=((Re=(ke=globalThis.navigator)==null?void 0:ke.userAgent)==null?void 0:Re.includes("jsdom"))===!0,yn=typeof WorkerGlobalScope!="undefined"&&globalThis instanceof WorkerGlobalScope,Tn=typeof DedicatedWorkerGlobalScope!="undefined"&&globalThis instanceof DedicatedWorkerGlobalScope,vn=typeof SharedWorkerGlobalScope!="undefined"&&globalThis instanceof SharedWorkerGlobalScope,$n=typeof ServiceWorkerGlobalScope!="undefined"&&globalThis instanceof ServiceWorkerGlobalScope,Ce,Ie,et=(Ie=(Ce=globalThis.navigator)==null?void 0:Ce.userAgentData)==null?void 0:Ie.platform,Oe,Ae,Be,Pe,En=et==="macOS"||((Oe=globalThis.navigator)==null?void 0:Oe.platform)==="MacIntel"||((Be=(Ae=globalThis.navigator)==null?void 0:Ae.userAgent)==null?void 0:Be.includes(" Mac "))===!0||((Pe=globalThis.process)==null?void 0:Pe.platform)==="darwin",Me,je,Sn=et==="Windows"||((Me=globalThis.navigator)==null?void 0:Me.platform)==="Win32"||((je=globalThis.process)==null?void 0:je.platform)==="win32",Le,Ge,We,_e,Ne,kn=et==="Linux"||((Ge=(Le=globalThis.navigator)==null?void 0:Le.platform)==null?void 0:Ge.startsWith("Linux"))===!0||((_e=(We=globalThis.navigator)==null?void 0:We.userAgent)==null?void 0:_e.includes(" Linux "))===!0||((Ne=globalThis.process)==null?void 0:Ne.platform)==="linux",Fe,De,He,Rn=et==="iOS"||((Fe=globalThis.navigator)==null?void 0:Fe.platform)==="MacIntel"&&((De=globalThis.navigator)==null?void 0:De.maxTouchPoints)>1||/iPad|iPhone|iPod/.test((He=globalThis.navigator)==null?void 0:He.platform),Ue,Ve,Ye,Je,Cn=et==="Android"||((Ue=globalThis.navigator)==null?void 0:Ue.platform)==="Android"||((Ye=(Ve=globalThis.navigator)==null?void 0:Ve.userAgent)==null?void 0:Ye.includes(" Android "))===!0||((Je=globalThis.process)==null?void 0:Je.platform)==="android";var h="\x1B[",ot="\x1B]",K="\x07",rt=";",Ke=!mt&&Bt.env.TERM_PROGRAM==="Apple_Terminal",vo=!mt&&Bt.platform==="win32",$o=mt?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Bt.cwd,Eo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?h+(t+1)+"G":h+(e+1)+rt+(t+1)+"H"},So=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=h+-t+"D":t>0&&(r+=h+t+"C"),e<0?r+=h+-e+"A":e>0&&(r+=h+e+"B"),r},qe=(t=1)=>h+t+"A",ko=(t=1)=>h+t+"B",Ro=(t=1)=>h+t+"C",Co=(t=1)=>h+t+"D",ze=h+"G",Io=Ke?"\x1B7":h+"s",Oo=Ke?"\x1B8":h+"u",Ao=h+"6n",Bo=h+"E",Po=h+"F",Mo=h+"?25l",jo=h+"?25h",Lo=t=>{let e="";for(let r=0;r<t;r++)e+=Qe+(r<t-1?qe():"");return t&&(e+=ze),e},Go=h+"K",Wo=h+"1K",Qe=h+"2K",_o=h+"J",No=h+"1J",At=h+"2J",Fo=h+"S",Do=h+"T",Ho="\x1Bc",Uo=vo?`${At}${h}0f`:`${At}${h}3J${h}H`,Vo=h+"?1049h",Yo=h+"?1049l",Jo=K,Ko=(t,e)=>[ot,"8",rt,rt,e,K,t,ot,"8",rt,rt,K].join(""),qo=(t,e={})=>{let r=`${ot}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+Buffer.from(t).toString("base64")+K},zo={setCwd:(t=$o())=>`${ot}50;CurrentDir=${t}${K}`,annotation(t,e={}){let r=`${ot}1337;`,o=e.x!==void 0,s=e.y!==void 0;if((o||s)&&!(o&&s&&e.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replaceAll("|",""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(o?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+K}};import nt from"node:process";import Pt from"node:process";import Qo from"node:os";import Xe from"node:tty";function $(t,e=globalThis.Deno?globalThis.Deno.args:Pt.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),s=e.indexOf("--");return o!==-1&&(s===-1||o<s)}var{env:f}=Pt,ft;$("no-color")||$("no-colors")||$("color=false")||$("color=never")?ft=0:($("color")||$("colors")||$("color=true")||$("color=always"))&&(ft=1);function Xo(){if(!("FORCE_COLOR"in f))return;if(f.FORCE_COLOR==="true")return 1;if(f.FORCE_COLOR==="false")return 0;if(f.FORCE_COLOR.length===0)return 1;let t=Math.min(Number.parseInt(f.FORCE_COLOR,10),3);if([0,1,2,3].includes(t))return t}function Zo(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function ts(t,{streamIsTTY:e,sniffFlags:r=!0}={}){let o=Xo();o!==void 0&&(ft=o);let s=r?ft:o;if(s===0)return 0;if(r){if($("color=16m")||$("color=full")||$("color=truecolor"))return 3;if($("color=256"))return 2}if("TF_BUILD"in f&&"AGENT_NAME"in f)return 1;if(t&&!e&&s===void 0)return 0;let n=s||0;if(f.TERM==="dumb")return n;if(Pt.platform==="win32"){let i=Qo.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in f)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(i=>i in f)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(i=>i in f)||f.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in f)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(f.TEAMCITY_VERSION)?1:0;if(f.COLORTERM==="truecolor"||f.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in f){let i=Number.parseInt((f.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(f.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(f.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(f.TERM)||"COLORTERM"in f?1:n}function dt(t,e={}){let r=ts(t,y({streamIsTTY:t&&t.isTTY},e));return Zo(r)}var Gn={stdout:dt({isTTY:Xe.isatty(1)}),stderr:dt({isTTY:Xe.isatty(2)})};import es from"process";function M(t,e=es.argv){let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),s=e.indexOf("--");return o!==-1&&(s===-1||o<s)}function Ze(t=""){var r;if(/^\d{3,4}$/.test(t)){let o=(r=/(\d{1,2})(\d{2})/.exec(t))!=null?r:[];return{major:0,minor:Number.parseInt(o[1],10),patch:Number.parseInt(o[2],10)}}let e=(t!=null?t:"").split(".").map(o=>Number.parseInt(o,10));return{major:e[0],minor:e[1],patch:e[2]}}function tr(t){let{CI:e,FORCE_HYPERLINK:r,NETLIFY:o,TEAMCITY_VERSION:s,TERM_PROGRAM:n,TERM_PROGRAM_VERSION:i,VTE_VERSION:a,TERM:c}=nt.env;if(r)return!(r.length>0&&Number.parseInt(r,10)===0);if(M("no-hyperlink")||M("no-hyperlinks")||M("hyperlink=false")||M("hyperlink=never"))return!1;if(M("hyperlink=true")||M("hyperlink=always")||o)return!0;if(!dt(t)||t&&!t.isTTY)return!1;if("WT_SESSION"in nt.env)return!0;if(nt.platform==="win32"||e||s)return!1;if(n){let p=Ze(i);switch(n){case"iTerm.app":return p.major===3?p.minor>=1:p.major>3;case"WezTerm":return p.major>=20200620;case"vscode":return p.major>1||p.major===1&&p.minor>=72;case"ghostty":return!0}}if(a){if(a==="0.50.0")return!1;let p=Ze(a);return p.major>0||p.minor>=50}switch(c){case"alacritty":return!0}return!1}var rs={stdout:tr(nt.stdout),stderr:tr(nt.stderr)},gt=rs;function j(t,e,s={}){var n=s,{target:r="stdout"}=n,o=q(n,["target"]);return gt[r]?st.link(t,e):o.fallback===!1?t:typeof o.fallback=="function"?o.fallback(t,e):`${t} (\u200B${e}\u200B)`}j.isSupported=gt.stdout;j.stderr=(t,e,r={})=>j(t,e,y({target:"stderr"},r));j.stderr.isSupported=gt.stderr;var rr="gitpick",or="4.6.1";var ns=`
|
|
8
|
+
With ${S(`${j("GitPick \u2197\uFE0F","https://github.com/nrjdalal/gitpick")}`)} clone specific directories or files from GitHub!
|
|
6
9
|
|
|
7
|
-
$ gitpick ${
|
|
10
|
+
$ gitpick ${U("<url>")} ${W("[target]")} ${v("[options]")}
|
|
8
11
|
|
|
9
|
-
${
|
|
12
|
+
${S("Hint:")}
|
|
10
13
|
[target] and [options] are optional. If not specified,
|
|
11
14
|
GitPick fallbacks to the default behavior of \`git clone\`.
|
|
12
15
|
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
+
${S("Arguments:")}
|
|
17
|
+
${U("url")} GitHub URL with path to file/folder/repository
|
|
18
|
+
${W("target")} Directory to clone into (optional)
|
|
16
19
|
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
21
|
-
${
|
|
20
|
+
${S("Options:")}
|
|
21
|
+
${v("-b, --branch ")} Branch to clone
|
|
22
|
+
${v("-o, --overwrite")} Skip overwrite prompt
|
|
23
|
+
${v("-r, --recursive")} Clone submodules
|
|
24
|
+
${v("-w, --watch [time]")} Watch the repository and sync every [time]
|
|
22
25
|
(e.g. 1h, 30m, 15s)
|
|
23
|
-
${
|
|
24
|
-
${
|
|
26
|
+
${v("-h, --help")} display help for command
|
|
27
|
+
${v("-v, --version")} display the version number
|
|
25
28
|
|
|
26
|
-
${
|
|
29
|
+
${S("Examples:")}
|
|
27
30
|
$ gitpick <url>
|
|
28
31
|
$ gitpick <url> [target]
|
|
29
32
|
$ gitpick <url> [target] -b [branch]
|
|
30
33
|
$ gitpick <url> [target] -w [time]
|
|
31
34
|
$ gitpick <url> [target] -b [branch] -w [time]
|
|
32
35
|
|
|
33
|
-
\u{1F680} More awesome tools at ${
|
|
34
|
-
${
|
|
35
|
-
With ${
|
|
36
|
-
${
|
|
37
|
-
Warning: The target directory is not empty. Use ${
|
|
38
|
-
\u{1F440} Watching every ${
|
|
39
|
-
`),await
|
|
40
|
-
${
|
|
41
|
-
Unexpected Error: `)}`)+JSON.stringify(t,null,2)),process.exit(1)}};
|
|
36
|
+
\u{1F680} More awesome tools at ${v("https://github.com/nrjdalal")}`,is=t=>{try{return ss(t)}catch(e){throw new Error(`Error parsing arguments: ${e.message}`)}},as=async()=>{try{let{positionals:t,values:e}=is({allowPositionals:!0,options:{branch:{type:"string",short:"b"},force:{type:"boolean",short:"f"},help:{type:"boolean",short:"h"},overwrite:{type:"boolean",short:"o"},recursive:{type:"boolean",short:"r"},version:{type:"boolean",short:"v"},watch:{type:"string",short:"w"}}});t.length||(e.version&&(console.log(`
|
|
37
|
+
${rr}@${or}`),process.exit(0)),console.log(ns),process.exit(0)),t[0]==="clone"&&t.shift();let[r,o]=t,s={branch:e.branch,force:e.force,overwrite:e.overwrite,recursive:e.recursive,watch:e.watch};console.log(`
|
|
38
|
+
With ${S(`${j("GitPick \u2197\uFE0F","https://github.com/nrjdalal/gitpick")}`)} clone specific directories or files from GitHub!`);let n=await ge(r,{branch:s.branch,target:o});if(n.type==="blob"){let a=n.target.split("/").filter(p=>p!==""),c=a[a.length-1];c!=="."&&c!==".."&&c.includes(".")?a.pop():c=n.path.split("/").pop()||c,n.target=[...a,c].join("/")}console.info(`
|
|
39
|
+
${W("\u2714")} ${n.owner}/${n.repository} ${v(n.type+":"+n.branch)} ${n.type==="repository"?`> ${W(n.target)}`:`${n.path.length?U(n.path)+" >":">"} ${W(n.target)}`}`);let i=os.resolve(n.target);if(s.overwrite=s.overwrite||s.force,s.watch&&(s.overwrite=!0),sr.existsSync(i)&&(await sr.promises.readdir(i)).length&&!s.overwrite&&(console.log(S(`${U(`
|
|
40
|
+
Warning: The target directory is not empty. Use ${v("-f")} | ${v("-o")} to overwrite.`)}`)),process.exit(1)),s.watch){console.log(`
|
|
41
|
+
\u{1F440} Watching every ${Ot(s.watch)/1e3+"s"}
|
|
42
|
+
`),await ht(n,s,i);let a=Ot(s.watch);setInterval(async()=>await ht(n,s,i),a)}else await ht(n,s,i),process.exit(0)}catch(t){t instanceof Error?console.log(S(`
|
|
43
|
+
${pt("Error: ")}`)+t.message):console.log(S(`${pt(`
|
|
44
|
+
Unexpected Error: `)}`)+JSON.stringify(t,null,2)),process.exit(1)}};as();
|