gitpick 4.8.0 → 4.9.0-canary.0

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.
Files changed (3) hide show
  1. package/README.md +13 -13
  2. package/dist/index.js +3 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -36,17 +36,17 @@ npx gitpick <url/shorthand> [target] [options]
36
36
  Examples:
37
37
 
38
38
  ```sh
39
- npx gitpick https://github.com/TanStack/router # repo without .git
40
- npx gitpick TanStack/router/tree/main/examples # a folder aka tree
41
- npx gitpick TanStack/router/blob/main/package.json # a file aka blob
42
-
43
- npx gitpick <url/shorthand> # default git behavior
44
- npx gitpick <url/shorthand> [target] # with optional target
45
- npx gitpick <url/shorthand> -b [branch/SHA] # branch or commit SHA
46
- npx gitpick <url/shorthand> -o # overwrite if exists
47
- npx gitpick <url/shorthand> -r # clone submodules
48
- npx gitpick <url/shorthand> -w 30s # sync every 30 seconds
49
- npx gitpick https://<token>@github.com/owner/repo # private repository
39
+ npx gitpick https://github.com/TanStack/router # repo without .git
40
+ npx gitpick TanStack/router/tree/main/examples # a folder aka tree
41
+ npx gitpick TanStack/router/blob/main/README.md # a file aka blob
42
+
43
+ npx gitpick <url/shorthand> # default git behavior
44
+ npx gitpick <url/shorthand> [target] # with optional target
45
+ npx gitpick <url/shorthand> -b [branch/SHA] # branch or commit SHA
46
+ npx gitpick <url/shorthand> -o # overwrite if exists
47
+ npx gitpick <url/shorthand> -r # clone submodules
48
+ npx gitpick <url/shorthand> -w 30s # sync every 30 seconds
49
+ npx gitpick https://<token>@github.com/owner/repo # private repository
50
50
  ```
51
51
 
52
52
  <img width="720" alt="Image" src="https://github.com/user-attachments/assets/ddbc41b4-bfc6-4287-bb85-eb949d723591" />
@@ -55,12 +55,12 @@ npx gitpick https://<token>@github.com/owner/repo # private repository
55
55
 
56
56
  ## 🔧 Options
57
57
 
58
- ```txt
58
+ ```sh
59
59
  -b, --branch Branch/SHA to clone
60
60
  -o, --overwrite Skip overwrite prompt
61
61
  -r, --recursive Clone submodules
62
62
  -w, --watch [time] Watch the repository and sync every [time]
63
- (e.g. 1h, 30m, 15s)
63
+ (e.g. 1h, 30m, 15s)
64
64
  -h, --help display help for command
65
65
  -v, --version display the version number
66
66
  ```
package/dist/index.js CHANGED
@@ -4,14 +4,14 @@ var Mt=Object.defineProperty,nr=Object.defineProperties;var ir=Object.getOwnProp
4
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 A(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)=>A(E,g,it,p)})}import C from"node:process";import{stripVTControlCharacters as fo}from"node:util";var R={};Wt(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:()=>k,cyan:()=>T,cyanBright:()=>so,dim:()=>Br,gray:()=>Hr,green:()=>O,greenBright:()=>to,hidden:()=>Wr,inverse:()=>Lr,italic:()=>Pr,magenta:()=>Fr,magentaBright:()=>oo,overline:()=>jr,red:()=>pt,redBright:()=>Zr,reset:()=>Or,strikethrough:()=>Gr,underline:()=>Mr,white:()=>Dr,whiteBright:()=>no,yellow:()=>_,yellowBright:()=>eo});import Ir from"node:tty";var se,ne,lt,ie,ae,Ar=(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(!Ar)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}},Or=l(0,0),k=l(1,22),Br=l(2,22),Pr=l(3,23),Mr=l(4,24),jr=l(53,55),Lr=l(7,27),Wr=l(8,28),Gr=l(9,29),_r=l(30,39),pt=l(31,39),O=l(32,39),_=l(33,39),Nr=l(34,39),Fr=l(35,39),T=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,mo=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,F,B,S,D,J,M,P,X,f,z,Q,ut,ce,le,pe,ue,he,fe,Ct=class{constructor(e={}){$(this,f);$(this,V);$(this,Y);$(this,N,-1);$(this,F);$(this,B);$(this,S);$(this,D);$(this,J,0);$(this,M);$(this,P);$(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,B,(s=e.text)!=null?s:""),w(this,S,(n=e.stream)!=null?n:C.stderr),w(this,D,(i=e.color)!=null?i:"cyan"),w(this,P,mo(u(this,S))),w(this,M,b(this,f,fe).bind(this))}start(e){return e&&w(this,B,e),this.isSpinning?this:(b(this,f,le).call(this),b(this,f,Q).call(this),b(this,f,ue).call(this),w(this,F,setInterval(()=>{b(this,f,Q).call(this)},u(this,Y))),this)}stop(e){return this.isSpinning?(clearInterval(u(this,F)),w(this,F,void 0),b(this,f,pe).call(this),this.clear(),b(this,f,he).call(this),e&&u(this,S).write(`${e}
5
5
  `),this):this}success(e){return b(this,f,z).call(this,wo,e)}error(e){return b(this,f,z).call(this,xo,e)}warning(e){return b(this,f,z).call(this,bo,e)}info(e){return b(this,f,z).call(this,go,e)}get isSpinning(){return u(this,F)!==void 0}get text(){return u(this,B)}set text(e){w(this,B,e!=null?e:""),b(this,f,Q).call(this)}get color(){return u(this,D)}set color(e){w(this,D,e),b(this,f,Q).call(this)}clear(){if(!u(this,P))return this;u(this,S).cursorTo(0);for(let e=0;e<u(this,J);e++)e>0&&u(this,S).moveCursor(0,-1),u(this,S).clearLine(1);return w(this,J,0),this}};V=new WeakMap,Y=new WeakMap,N=new WeakMap,F=new WeakMap,B=new WeakMap,S=new WeakMap,D=new WeakMap,J=new WeakMap,M=new WeakMap,P=new WeakMap,X=new WeakMap,f=new WeakSet,z=function(e,r){return this.stop(`${e} ${r!=null?r:u(this,B)}`)},Q=function(){var n;let e=Date.now();(u(this,N)===-1||e-u(this,X)>=u(this,Y))&&(w(this,N,++_t(this,N)._%u(this,V).length),w(this,X,e));let r=(n=R[u(this,D)])!=null?n:R.cyan,o=u(this,V)[u(this,N)],s=`${r(o)} ${u(this,B)}`;u(this,P)||(s+=`
6
6
  `),this.clear(),b(this,f,ut).call(this,s),u(this,P)&&w(this,J,b(this,f,ce).call(this,s))},ut=function(e){u(this,S).write(e)},ce=function(e){var n;let r=(n=u(this,S).columns)!=null?n:80,o=fo(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,P)&&b(this,f,ut).call(this,"\x1B[?25l")},pe=function(){u(this,P)&&b(this,f,ut).call(this,"\x1B[?25h")},ue=function(){C.once("SIGINT",u(this,M)),C.once("SIGTERM",u(this,M))},he=function(){C.off("SIGINT",u(this,M)),C.off("SIGTERM",u(this,M))},fe=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 A("git",["config","--global","core.longpaths","true"]);let o=`https://${t.token?t.token+"@":t.token}github.com/${t.owner}/${t.repository}.git`,s=me.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 A("git",["clone",o,s,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(p){await A("git",["clone",o,s,...e.recursive?["--recursive"]:[]]),await A("git",["checkout",t.branch],{cwd:s})}let a=me.resolve(s,t.path);(await tt.promises.stat(a)).isDirectory()?(await tt.promises.mkdir(r,{recursive:!0}),await $t(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 At(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 A("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={};Wt(st,{beep:()=>Jo,clearScreen:()=>Ho,clearTerminal:()=>Uo,cursorBackward:()=>Co,cursorDown:()=>ko,cursorForward:()=>Ro,cursorGetPosition:()=>Oo,cursorHide:()=>Mo,cursorLeft:()=>ze,cursorMove:()=>So,cursorNextLine:()=>Bo,cursorPrevLine:()=>Po,cursorRestorePosition:()=>Ao,cursorSavePosition:()=>Io,cursorShow:()=>jo,cursorTo:()=>Eo,cursorUp:()=>qe,enterAlternativeScreen:()=>Vo,eraseDown:()=>_o,eraseEndLine:()=>Wo,eraseLine:()=>Qe,eraseLines:()=>Lo,eraseScreen:()=>Ot,eraseStartLine:()=>Go,eraseUp:()=>No,exitAlternativeScreen:()=>Yo,iTerm:()=>zo,image:()=>qo,link:()=>Ko,scrollDown:()=>Do,scrollUp:()=>Fo});import Bt from"node:process";var we,ft=((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,$e,ve,wn=((ve=($e=globalThis.Deno)==null?void 0:$e.version)==null?void 0:ve.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,$n=typeof SharedWorkerGlobalScope!="undefined"&&globalThis instanceof SharedWorkerGlobalScope,vn=typeof ServiceWorkerGlobalScope!="undefined"&&globalThis instanceof ServiceWorkerGlobalScope,Ce,Ie,et=(Ie=(Ce=globalThis.navigator)==null?void 0:Ce.userAgentData)==null?void 0:Ie.platform,Ae,Oe,Be,Pe,En=et==="macOS"||((Ae=globalThis.navigator)==null?void 0:Ae.platform)==="MacIntel"||((Be=(Oe=globalThis.navigator)==null?void 0:Oe.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,We,Ge,_e,Ne,kn=et==="Linux"||((We=(Le=globalThis.navigator)==null?void 0:Le.platform)==null?void 0:We.startsWith("Linux"))===!0||((_e=(Ge=globalThis.navigator)==null?void 0:Ge.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=!ft&&Bt.env.TERM_PROGRAM==="Apple_Terminal",$o=!ft&&Bt.platform==="win32",vo=ft?()=>{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",Ao=Ke?"\x1B8":h+"u",Oo=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},Wo=h+"K",Go=h+"1K",Qe=h+"2K",_o=h+"J",No=h+"1J",Ot=h+"2J",Fo=h+"S",Do=h+"T",Ho="\x1Bc",Uo=$o?`${Ot}${h}0f`:`${Ot}${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=vo())=>`${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 v(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:m}=Pt,mt;v("no-color")||v("no-colors")||v("color=false")||v("color=never")?mt=0:(v("color")||v("colors")||v("color=true")||v("color=always"))&&(mt=1);function Xo(){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 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&&(mt=o);let s=r?mt:o;if(s===0)return 0;if(r){if(v("color=16m")||v("color=full")||v("color=truecolor"))return 3;if(v("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(t&&!e&&s===void 0)return 0;let n=s||0;if(m.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 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:n;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:n}function dt(t,e={}){let r=ts(t,y({streamIsTTY:t&&t.isTTY},e));return Zo(r)}var Wn={stdout:dt({isTTY:Xe.isatty(1)}),stderr:dt({isTTY:Xe.isatty(2)})};import es from"process";function j(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(j("no-hyperlink")||j("no-hyperlinks")||j("hyperlink=false")||j("hyperlink=never"))return!1;if(j("hyperlink=true")||j("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 L(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)`}L.isSupported=gt.stdout;L.stderr=(t,e,r={})=>L(t,e,y({target:"stderr"},r));L.stderr.isSupported=gt.stderr;var rr="gitpick",or="4.8.0";var ns=`
7
+ `),s=0;for(let i of o)s+=Math.max(1,Math.ceil(i.length/r));return s},le=function(){u(this,P)&&b(this,f,ut).call(this,"\x1B[?25l")},pe=function(){u(this,P)&&b(this,f,ut).call(this,"\x1B[?25h")},ue=function(){C.once("SIGINT",u(this,M)),C.once("SIGTERM",u(this,M))},he=function(){C.off("SIGINT",u(this,M)),C.off("SIGTERM",u(this,M))},fe=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 A("git",["config","--global","core.longpaths","true"]);let o=`https://${t.token?t.token+"@":t.token}github.com/${t.owner}/${t.repository}.git`,s=me.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 A("git",["clone",o,s,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(p){await A("git",["clone",o,s,...e.recursive?["--recursive"]:[]]),await A("git",["checkout",t.branch],{cwd:s})}let a=me.resolve(s,t.path);(await tt.promises.stat(a)).isDirectory()?(await tt.promises.mkdir(r,{recursive:!0}),await $t(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 At(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 A("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={};Wt(st,{beep:()=>Jo,clearScreen:()=>Ho,clearTerminal:()=>Uo,cursorBackward:()=>Co,cursorDown:()=>ko,cursorForward:()=>Ro,cursorGetPosition:()=>Oo,cursorHide:()=>Mo,cursorLeft:()=>ze,cursorMove:()=>So,cursorNextLine:()=>Bo,cursorPrevLine:()=>Po,cursorRestorePosition:()=>Ao,cursorSavePosition:()=>Io,cursorShow:()=>jo,cursorTo:()=>Eo,cursorUp:()=>qe,enterAlternativeScreen:()=>Vo,eraseDown:()=>_o,eraseEndLine:()=>Wo,eraseLine:()=>Qe,eraseLines:()=>Lo,eraseScreen:()=>Ot,eraseStartLine:()=>Go,eraseUp:()=>No,exitAlternativeScreen:()=>Yo,iTerm:()=>zo,image:()=>qo,link:()=>Ko,scrollDown:()=>Do,scrollUp:()=>Fo});import Bt from"node:process";var we,ft=((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,$e,ve,wn=((ve=($e=globalThis.Deno)==null?void 0:$e.version)==null?void 0:ve.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,$n=typeof SharedWorkerGlobalScope!="undefined"&&globalThis instanceof SharedWorkerGlobalScope,vn=typeof ServiceWorkerGlobalScope!="undefined"&&globalThis instanceof ServiceWorkerGlobalScope,Ce,Ie,et=(Ie=(Ce=globalThis.navigator)==null?void 0:Ce.userAgentData)==null?void 0:Ie.platform,Ae,Oe,Be,Pe,En=et==="macOS"||((Ae=globalThis.navigator)==null?void 0:Ae.platform)==="MacIntel"||((Be=(Oe=globalThis.navigator)==null?void 0:Oe.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,We,Ge,_e,Ne,kn=et==="Linux"||((We=(Le=globalThis.navigator)==null?void 0:Le.platform)==null?void 0:We.startsWith("Linux"))===!0||((_e=(Ge=globalThis.navigator)==null?void 0:Ge.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=!ft&&Bt.env.TERM_PROGRAM==="Apple_Terminal",$o=!ft&&Bt.platform==="win32",vo=ft?()=>{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",Ao=Ke?"\x1B8":h+"u",Oo=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},Wo=h+"K",Go=h+"1K",Qe=h+"2K",_o=h+"J",No=h+"1J",Ot=h+"2J",Fo=h+"S",Do=h+"T",Ho="\x1Bc",Uo=$o?`${Ot}${h}0f`:`${Ot}${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=vo())=>`${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 v(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:m}=Pt,mt;v("no-color")||v("no-colors")||v("color=false")||v("color=never")?mt=0:(v("color")||v("colors")||v("color=true")||v("color=always"))&&(mt=1);function Xo(){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 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&&(mt=o);let s=r?mt:o;if(s===0)return 0;if(r){if(v("color=16m")||v("color=full")||v("color=truecolor"))return 3;if(v("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(t&&!e&&s===void 0)return 0;let n=s||0;if(m.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 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:n;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:n}function dt(t,e={}){let r=ts(t,y({streamIsTTY:t&&t.isTTY},e));return Zo(r)}var Wn={stdout:dt({isTTY:Xe.isatty(1)}),stderr:dt({isTTY:Xe.isatty(2)})};import es from"process";function j(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(j("no-hyperlink")||j("no-hyperlinks")||j("hyperlink=false")||j("hyperlink=never"))return!1;if(j("hyperlink=true")||j("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 L(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)`}L.isSupported=gt.stdout;L.stderr=(t,e,r={})=>L(t,e,y({target:"stderr"},r));L.stderr.isSupported=gt.stderr;var rr="gitpick",or="4.9.0-canary.0";var ns=`
8
8
  With ${k(`${L("GitPick \u2197\uFE0F","https://github.com/nrjdalal/gitpick")}`)} clone specific directories or files from GitHub!
9
9
 
10
10
  $ gitpick ${_("<url>")} ${O("[target]")} ${T("[options]")}
11
11
 
12
12
  ${k("Hint:")}
13
- [target] and [options] are optional. If not specified,
14
- GitPick fallbacks to the default behavior of \`git clone\`.
13
+ [target] and [options] are optional and if not specified,
14
+ GitPick fallbacks to the default behavior of \`git clone\`
15
15
 
16
16
  ${k("Arguments:")}
17
17
  ${_("url")} GitHub URL with path to file/folder/repository
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitpick",
3
- "version": "4.8.0",
3
+ "version": "4.9.0-canary.0",
4
4
  "description": "Clone exactly what you need aka straightforward project scaffolding!",
5
5
  "keywords": [
6
6
  "clone",