gitpick 4.4.0-canary.0 → 4.4.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/README.md +2 -0
- package/dist/index.js +16 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ npx gitpick <url/shorthand> -w 30s # sync every 30 seconds
|
|
|
49
49
|
npx gitpick https://<token>@github.com/owner/repo # private repo
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
<img width="620" alt="Image" src="https://github.com/user-attachments/assets/98b4b226-8560-4d83-9da5-ea500ff8179e" />
|
|
53
|
+
|
|
52
54
|
---
|
|
53
55
|
|
|
54
56
|
## 🔧 Options
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var vt=Object.defineProperty,kt=Object.defineProperties;var Et=Object.getOwnPropertyDescriptors;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]:l}=yield new
|
|
5
|
-
\u{1F50D} Picking ${t.type}${t.type==="repository"?" without .git":" from repository"}...`);let s=performance.now();try{await b("git",["clone",o,i,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(c){console.log("\u{1F504} Using robust checkout process..."),await b("git",["clone",o,i,...e.recursive?["--recursive"]:[]]),await b("git",["checkout",t.branch],{cwd:i})}let n=mt.resolve(i,t.path);(await E.promises.stat(n)).isDirectory()?(await E.promises.mkdir(r,{recursive:!0}),await U(n,r)):(await E.promises.mkdir(r.split("/").slice(0,-1).join("/"),{recursive:!0}),await E.promises.copyFile(n,r)),e.watch?console.log("- Synced at "+new Date().toLocaleTimeString()):console.log(`\u{1F525} Picked ${t.type}${t.type==="repository"?" without .git":" from repository"} in ${((performance.now()-s)/1e3).toFixed(2)} seconds!`),await E.promises.rm(i,{recursive:!0,force:!0})};import Kt from"node:tty";var ht,ut,R,ft,dt,Qt=(dt=(ft=(R=(ut=(ht=Kt)==null?void 0:ht.WriteStream)==null?void 0:ut.prototype)==null?void 0:R.hasColors)==null?void 0:ft.call(R))!=null?dt:!1,h=(t,e)=>{if(!Qt)return i=>i;let r=`\x1B[${t}m`,o=`\x1B[${e}m`;return i=>{let s=i+"",n=s.indexOf(o);if(n===-1)return r+s+o;let a=r,c=0;for(;n!==-1;)a+=s.slice(c,n)+r,c=n+o.length,n=s.indexOf(o,c);return a+=s.slice(c)+o,a}},Ke=h(0,0),w=h(1,22),Qe=h(2,22),Ye=h(3,23),Ze=h(4,24),Xe=h(53,55),tr=h(7,27),er=h(8,28),rr=h(9,29),or=h(30,39),H=h(31,39),A=h(32,39),j=h(33,39),sr=h(34,39),ir=h(35,39),f=h(36,39),nr=h(37,39),ar=h(90,39);function N(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 i=parseInt(o[1],10);switch(o[2]){case"h":r+=i*36e5;break;case"m":r+=i*6e4;break;case"s":r+=i*1e3;break}}return r}var gt=async t=>{var i,s;let e=(await b("git",["ls-remote",t])).stdout,r=(i=e.match(/(.+)\s+HEAD/))==null?void 0:i[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/,i=t.match(o),s="";i&&(s=i[1],t=t.replace(o,"https://github.com"));let n=["git@github.com:","https://github.com/","https://raw.githubusercontent.com/"];for(let P of n)if(t.startsWith(P)){t=t.replace(P,"");break}let a=t.split("/"),c=a[0],p=a[1].endsWith(".git")?a[1].slice(0,-4):a[1],l=a[2]==="blob"?"blob":a[2]==="tree"?"tree":a[2]+a[3]==="refsheads"?"raw":"repository",u=e||(l==="repository"?await gt(`https://${s&&s+"@"}github.com/${c}/${p}`):l==="raw"?a[4]:a[3]),g=l?l==="raw"?a.slice(5).join("/"):a.slice(4).join("/"):a.slice(2).join("/")||"/",m=r||(l==="blob"?".":g.split("/").pop()||p);return{token:s,owner:c,repository:p,type:l,branch:u,path:g,target:m}}var bt="gitpick",$t="4.4.0-canary.0";var Xt=`
|
|
2
|
+
var vt=Object.defineProperty,kt=Object.defineProperties;var Et=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var k=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),jt=t=>{throw TypeError(t)};var T=(t,e,r)=>e in t?vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f=(t,e)=>{for(var r in e||(e={}))_.call(e,r)&&T(t,r,e[r]);if(S)for(var r of S(e))J.call(e,r)&&T(t,r,e[r]);return t},x=(t,e)=>kt(t,Et(e));var D=(t,e)=>{var r={};for(var o in t)_.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&S)for(var o of S(t))e.indexOf(o)<0&&J.call(t,o)&&(r[o]=t[o]);return r};var V=(t,e,r)=>T(t,typeof e!="symbol"?e+"":e,r);var b=function(t,e){this[0]=t,this[1]=e},F=(t,e,r)=>{var o=(n,a,c,p)=>{try{var l=r[n](a),u=(a=l.value)instanceof b,g=l.done;Promise.resolve(u?a[0]:a).then(m=>u?o(n==="return"?n:"next",a[1]?{done:m.done,value:m.value}:m,c,p):c({value:m,done:g})).catch(m=>o("throw",m,c,p))}catch(m){p(m)}},i=n=>s[n]=a=>new Promise((c,p)=>o(n,a,c,p)),s={};return r=r.apply(t,e),s[k("asyncIterator")]=()=>s,i("next"),i("throw"),i("return"),s},q=t=>{var e=t[k("asyncIterator")],r=!1,o,i={};return e==null?(e=t[k("iterator")](),o=s=>i[s]=n=>e[s](n)):(e=e.call(t),o=s=>i[s]=n=>{if(r){if(r=!1,s==="throw")throw n;return n}return r=!0,{done:!1,value:new b(new Promise(a=>{var c=e[s](n);c instanceof Object||jt("Object expected"),a(c)}),1)}}),i[k("iterator")]=()=>i,o("next"),"throw"in e?o("throw"):i.throw=s=>{throw s},"return"in e&&o("return"),i},I=(t,e,r)=>(e=t[k("asyncIterator")])?e.call(t):(t=t[k("iterator")](),e={},r=(o,i)=>(i=t[o])&&(e[o]=s=>new Promise((n,a,c)=>(s=i.call(t,s),c=s.done,Promise.resolve(s.value).then(p=>n({value:p,done:c}),a)))),r("next"),r("return"),e);import xt from"fs";import{parseArgs as Yt}from"node:util";import Zt from"path";import P from"node:fs";import Qt from"node:os";import dt from"node:path";import Pt from"node:tty";var z,K,R,Q,Y,Ct=(Y=(Q=(R=(K=(z=Pt)==null?void 0:z.WriteStream)==null?void 0:K.prototype)==null?void 0:R.hasColors)==null?void 0:Q.call(R))!=null?Y:!1,h=(t,e)=>{if(!Ct)return i=>i;let r=`\x1B[${t}m`,o=`\x1B[${e}m`;return i=>{let s=i+"",n=s.indexOf(o);if(n===-1)return r+s+o;let a=r,c=0;for(;n!==-1;)a+=s.slice(c,n)+r,c=n+o.length,n=s.indexOf(o,c);return a+=s.slice(c)+o,a}},se=h(0,0),w=h(1,22),ie=h(2,22),ne=h(3,23),ae=h(4,24),ce=h(53,55),pe=h(7,27),le=h(8,28),me=h(9,29),he=h(30,39),O=h(31,39),y=h(32,39),j=h(33,39),ue=h(34,39),fe=h(35,39),d=h(36,39),de=h(37,39),ge=h(90,39);import U from"node:fs";import Z from"node:path";var B=async(t,e)=>{let r=await U.promises.readdir(t,{withFileTypes:!0});await U.promises.mkdir(e,{recursive:!0});for(let o of r){if(o.name===".git")continue;let i=Z.join(t,o.name),s=Z.join(e,o.name);o.isDirectory()?await B(i,s):await U.promises.copyFile(i,s)}};import St from"node:process";import{stripVTControlCharacters as It}from"node:util";var X=t=>({start:St.hrtime.bigint(),command:t.map(e=>Rt(It(e))).join(" "),state:{stdout:"",stderr:"",output:""}}),Rt=t=>/[^\w./-]/.test(t)?`'${t.replaceAll("'","'\\''")}'`:t;import E from"node:path";import{fileURLToPath as At}from"node:url";import tt from"node:process";var et=c=>{var p=c,{stdin:t,stdout:e,stderr:r,stdio:o=[t,e,r],env:i,preferLocal:s,cwd:n="."}=p,a=D(p,["stdin","stdout","stderr","stdio","env","preferLocal","cwd"]);var m;let l=n instanceof URL?At(n):E.resolve(n),u=i?f(f({},tt.env),i):void 0,g=(m=o[0])==null?void 0:m.string;return x(f({},a),{input:g,stdio:g===void 0?o:["pipe",...o.slice(1)],env:s?Tt(u!=null?u:tt.env,l):u,cwd:l})},Tt=(i,o)=>{var s=i,{Path:t="",PATH:e=t}=s,r=D(s,["Path","PATH"]);let n=e.split(E.delimiter),a=rt([],E.resolve(o)).map(c=>E.join(c,"node_modules/.bin")).filter(c=>!n.includes(c));return x(f({},r),{PATH:[...a,e].filter(Boolean).join(E.delimiter)})},rt=(t,e)=>t.at(-1)===e?t:rt([...t,e],E.resolve(e,".."));import{spawn as _t}from"node:child_process";import{once as Jt}from"node:events";import lt from"node:process";import{stat as Dt}from"node:fs/promises";import ot from"node:path";import st from"node:process";var it=async(t,e,r)=>await Ft(t,r)?[W(t),e.map(o=>Bt(o)),x(f({},r),{shell:!0})]:[t,e,r],Ft=async(t,{shell:e,cwd:r,env:o=st.env})=>st.platform==="win32"&&!e&&!await Ot(t,r,o),Ot=async(t,e,{Path:r="",PATH:o=r})=>{var i,s;return nt.some(n=>t.toLowerCase().endsWith(n))||((s=L[i=`${t}\0${e}\0${o}`])!=null?s:L[i]=await Ut(t,e,o))},L={},Ut=async(t,e,r)=>{let o=r.split(ot.delimiter).filter(Boolean).map(i=>i.replace(/^"(.*)"$/,"$1"));try{await Promise.all(nt.flatMap(i=>[e,...o].map(s=>`${ot.resolve(s,t)}${i}`)).map(async i=>{try{await Dt(i)}catch(s){return}throw 0}))}catch(i){return!0}return!1},nt=[".exe",".com"],Bt=t=>W(W(`"${t.replaceAll(/(\\*)"/g,'$1$1\\"').replace(/(\\*)$/,"$1$1")}"`)),W=t=>t.replaceAll(/([()\][%!^"`<>&|;, *?])/g,"^$1");import{once as Lt,on as Wt}from"node:events";import Mt from"node:process";var at=async(t,{input:e},r)=>{let o=await t;e!==void 0&&o.stdin.end(e);let i=Lt(o,"close");try{return await Promise.race([i,...o.stdio.filter(Boolean).map(s=>Gt(s))]),Ht(r,ct(o)),pt(r)}catch(s){throw await Promise.allSettled([i]),G(s,o,r)}},Gt=async t=>{try{for(var e=I(Wt(t,"error")),r,o,i;r=!(o=await e.next()).done;r=!1){let[s]=o.value;if(!["ERR_STREAM_PREMATURE_CLOSE","EPIPE"].includes(s==null?void 0:s.code))throw s}}catch(o){i=[o]}finally{try{r&&(o=e.return)&&await o.call(e)}finally{if(i)throw i[0]}}},Ht=({command:t},{exitCode:e,signalName:r})=>{if(r!==void 0)throw new v(`Command was terminated with ${r}: ${t}`);if(e!==void 0)throw new v(`Command failed with exit code ${e}: ${t}`)},G=(t,e,r)=>Object.assign(Nt(t,r),ct(e),pt(r)),Nt=(t,{command:e})=>t instanceof v?t:new v(`Command failed: ${e}`,{cause:t}),v=class extends Error{constructor(){super(...arguments);V(this,"name","SubprocessError")}},ct=({exitCode:t,signalCode:e})=>f(f({},t<1?{}:{exitCode:t}),e===null?{}:{signalName:e}),pt=({state:{stdout:t,stderr:e,output:r},command:o,start:i})=>({stdout:M(t),stderr:M(e),output:M(r),command:o,durationMs:Number(Mt.hrtime.bigint()-i)/1e6}),M=t=>t.at(-1)===`
|
|
3
|
+
`?t.slice(0,t.at(-2)==="\r"?-2:-1):t;var ht=async(t,e,r,o)=>{try{[t,e]=["node","node.exe"].includes(t.toLowerCase())?[lt.execPath,[...lt.execArgv.filter(s=>!s.startsWith("--inspect")),...e]]:[t,e];let i=_t(...await it(t,e,r));return mt(i.stdout,o,"stdout"),mt(i.stderr,o,"stderr"),i.once("error",()=>{}),await Jt(i,"spawn"),i}catch(i){throw G(i,{},o)}},mt=(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 Vt}from"node:stream/promises";var ut=async t=>{var o;let[[e,r]]=await Promise.all([Promise.allSettled(t),qt(t)]);if(r.reason)throw r.reason.pipedFrom=(o=e.reason)!=null?o:e.value,r.reason;if(e.reason)throw e.reason;return x(f({},r.value),{pipedFrom:e.value})},qt=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.');Vt(e,r).catch(()=>{})}catch(e){throw await Promise.allSettled(t.map(({nodeChildProcess:r})=>zt(r))),e}},zt=async t=>{let{stdin:e}=await t;e.end()};var H=function(o,i,s){return F(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]:l}=yield new b(t.nodeChildProcess);if(!l)return;let u="";try{for(var n=I(l.iterator({destroyOnReturn:!1})),a,c,p;a=!(c=yield new b(n.next())).done;a=!1){let g=c.value;let m=`${u}${g}`.split(/\r?\n/);u=m.pop(),yield*q(m)}}catch(c){p=[c]}finally{try{a&&(c=n.return)&&(yield new b(c.call(n)))}finally{if(p)throw p[0]}}u&&(yield u)}finally{yield new b(t)}})},ft=function(...t){return F(this,null,function*(){try{let e=[];for(;t.length>0;){e=t.map((n,a)=>{var c;return(c=e[a])!=null?c:Kt(n)});let[{value:r,done:o},i]=yield new b(Promise.race(e.map((n,a)=>Promise.all([n,a])))),[s]=t.splice(i,1);e.splice(i,1),o||(t.push(s),yield r)}}finally{yield new b(Promise.all(t.map(e=>e.return())))}})},Kt=async t=>{try{return await t.next()}catch(e){await t.throw(e)}};function $(t,e,r,o){let[i=[],s={}]=Array.isArray(e)?[e,r]:[[],e],n=X([t,...i]),a=et(s),c=ht(t,i,a,n),p=at(c,a,n);Object.assign(p,{nodeChildProcess:c}),p=o?ut([o,p]):p;let l=H(p,n,"stdout"),u=H(p,n,"stderr");return Object.assign(p,{nodeChildProcess:c,stdout:l,stderr:u,[Symbol.asyncIterator]:()=>ft(l,u),pipe:(g,m,C)=>$(g,m,C,p)})}var A=async(t,e,r)=>{process.platform==="win32"&&await $("git",["config","--global","core.longpaths","true"]);let o=`https://${t.token?t.token+"@":t.token}github.com/${t.owner}/${t.repository}.git`,i=dt.resolve(Qt.tmpdir(),`${t.repository}-${Date.now()}${Math.random().toString(16).slice(2,6)}`);e.watch||console.log(`${y("\u2714")} Picking ${t.type}${t.type==="repository"?" without .git":" from repository"}...`);let s=performance.now();try{await $("git",["clone",o,i,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(c){console.log(`${y("\u2714")} Using robust checkout process...`),await $("git",["clone",o,i,...e.recursive?["--recursive"]:[]]),await $("git",["checkout",t.branch],{cwd:i})}let n=dt.resolve(i,t.path);(await P.promises.stat(n)).isDirectory()?(await P.promises.mkdir(r,{recursive:!0}),await B(n,r)):(await P.promises.mkdir(r.split("/").slice(0,-1).join("/"),{recursive:!0}),await P.promises.copyFile(n,r)),e.watch?console.log("- Synced at "+new Date().toLocaleTimeString()):console.log(`${y("\u2714")} Picked ${t.type}${t.type==="repository"?" without .git":" from repository"} in ${((performance.now()-s)/1e3).toFixed(2)} seconds!`),await P.promises.rm(i,{recursive:!0,force:!0})};function N(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 i=parseInt(o[1],10);switch(o[2]){case"h":r+=i*36e5;break;case"m":r+=i*6e4;break;case"s":r+=i*1e3;break}}return r}var gt=async t=>{var i,s;let e=(await $("git",["ls-remote",t])).stdout,r=(i=e.match(/(.+)\s+HEAD/))==null?void 0:i[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/,i=t.match(o),s="";i&&(s=i[1],t=t.replace(o,"https://github.com"));let n=["git@github.com:","https://github.com/","https://raw.githubusercontent.com/"];for(let C of n)if(t.startsWith(C)){t=t.replace(C,"");break}let a=t.split("/"),c=a[0],p=a[1].endsWith(".git")?a[1].slice(0,-4):a[1],l=a[2]==="blob"?"blob":a[2]==="tree"?"tree":a[2]+a[3]==="refsheads"?"raw":"repository",u=e||(l==="repository"?await gt(`https://${s&&s+"@"}github.com/${c}/${p}`):l==="raw"?a[4]:a[3]),g=l?l==="raw"?a.slice(5).join("/"):a.slice(4).join("/"):a.slice(2).join("/")||"/",m=r||(l==="blob"?".":g.split("/").pop()||p);return{token:s,owner:c,repository:p,type:l,branch:u,path:g,target:m}}var bt="gitpick",$t="4.4.1";var Xt=`
|
|
6
5
|
${w("With GitPick, you can clone precisely what you need.")}
|
|
7
6
|
|
|
8
|
-
${w("gitpick")} ${j("<url>")} ${
|
|
7
|
+
${w("gitpick")} ${j("<url>")} ${y("[target]")} ${d("[options]")}
|
|
9
8
|
|
|
10
9
|
${w("Hint:")} Target is optional, and follows default git clone behavior.
|
|
11
10
|
|
|
12
11
|
${w("Arguments:")}
|
|
13
12
|
${j("url")} GitHub URL with path to file/folder/repository
|
|
14
|
-
${
|
|
13
|
+
${y("target")} Directory to clone into (optional)
|
|
15
14
|
|
|
16
15
|
${w("Options:")}
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
16
|
+
${d("-b, --branch ")} Branch to clone
|
|
17
|
+
${d("-o, --overwrite")} Skip overwrite prompt
|
|
18
|
+
${d("-r, --recursive")} Clone submodules
|
|
19
|
+
${d("-w, --watch [time]")} Watch the repository and sync every [time]
|
|
21
20
|
(e.g. 1h, 30m, 15s)
|
|
22
|
-
${
|
|
23
|
-
${
|
|
21
|
+
${d("-h, --help")} display help for command
|
|
22
|
+
${d("-v, --version")} display the version number
|
|
24
23
|
|
|
25
24
|
${w("Examples:")}
|
|
26
25
|
$ gitpick <url>
|
|
@@ -29,11 +28,11 @@ ${w("Examples:")}
|
|
|
29
28
|
$ gitpick <url> [target] -w [time]
|
|
30
29
|
$ gitpick <url> [target] -b [branch] -w [time]
|
|
31
30
|
|
|
32
|
-
\u{1F680} More awesome tools at ${
|
|
31
|
+
\u{1F680} More awesome tools at ${d("https://github.com/nrjdalal")}`,te=t=>{try{return Yt(t)}catch(e){throw new Error(`Error parsing arguments: ${e.message}`)}},ee=async()=>{try{let{positionals:t,values:e}=te({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(`
|
|
33
32
|
${bt}@${$t}`),process.exit(0)),console.log(Xt),process.exit(0)),t[0]==="clone"&&t.shift();let[r,o]=t,i={branch:e.branch,force:e.force,overwrite:e.overwrite,recursive:e.recursive,watch:e.watch};console.log(`${w("GitPick")} - Clone specific directories or files from GitHub!`);let s=await wt(r,{branch:i.branch,target:o});if(s.type==="blob"){let a=s.target.split("/").filter(p=>p!==""),c=a[a.length-1];c!=="."&&c!==".."&&c.includes(".")?a.pop():c=s.path.split("/").pop()||c,s.target=[...a,c].join("/")}console.info(`
|
|
34
|
-
${s.owner}/${s.repository} ${
|
|
35
|
-
Warning: The target directory is not empty. Use ${
|
|
33
|
+
${y("\u2714")} ${s.owner}/${s.repository} ${d(s.type+":"+s.branch)} ${s.type==="repository"?`> ${y(s.target)}`:`${s.path.length?j(s.path)+" >":">"} ${y(s.target)}`}`);let n=Zt.resolve(s.target);if(i.overwrite=i.overwrite||i.force,i.watch&&(i.overwrite=!0),xt.existsSync(n+(s.type==="blob"?"/"+s.path.split("/").pop():""))&&(await xt.promises.readdir(n)).length&&!i.overwrite&&(console.log(w(`${j(`
|
|
34
|
+
Warning: The target directory is not empty. Use ${d("-f")} | ${d("-o")} to overwrite.`)}`)),process.exit(1)),i.watch){console.log(`
|
|
36
35
|
\u{1F440} Watching every ${N(i.watch)/1e3+"s"}
|
|
37
|
-
`),await
|
|
38
|
-
${
|
|
36
|
+
`),await A(s,i,n);let a=N(i.watch);setInterval(async()=>await A(s,i,n),a)}else await A(s,i,n),process.exit(0)}catch(t){t instanceof Error?console.log(w(`
|
|
37
|
+
${O("Error: ")}`)+t.message):console.log(w(`${O(`
|
|
39
38
|
Unexpected Error: `)}`)+JSON.stringify(t,null,2)),process.exit(1)}};ee();
|