just-bash 2.12.0 → 2.12.2
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/Bash.d.ts +5 -0
- package/dist/bin/chunks/{awk2-YRDDZZBN.js → awk2-ZE5HJBNV.js} +1 -1
- package/dist/bin/chunks/chunk-253LRF5J.js +11 -0
- package/dist/bin/chunks/chunk-2BC3N3L2.js +16 -0
- package/dist/bin/chunks/chunk-2FFXXW3F.js +14 -0
- package/dist/bin/chunks/{chunk-D2VMRCQU.js → chunk-35JD7YEM.js} +12 -12
- package/dist/bin/chunks/chunk-435ZOZCY.js +63 -0
- package/dist/bin/{shell/chunks/chunk-JXC25GVQ.js → chunks/chunk-47HZU3SY.js} +1 -1
- package/dist/bin/chunks/chunk-4FNW6LFM.js +5 -0
- package/dist/bin/chunks/chunk-4OALHZXB.js +2 -0
- package/dist/bin/chunks/chunk-4PZYIYYG.js +36 -0
- package/dist/bin/chunks/{chunk-HA4QZ6XJ.js → chunk-DREQRXNN.js} +4 -4
- package/dist/bin/chunks/chunk-IYZRLSTQ.js +2 -0
- package/dist/bin/chunks/chunk-JJHAWOIB.js +2 -0
- package/dist/bin/chunks/{chunk-F37UEO7A.js → chunk-JNPUO56K.js} +1 -1
- package/dist/bin/chunks/{chunk-DAGNL3F2.js → chunk-MZKPWGID.js} +24 -24
- package/dist/bin/chunks/chunk-N4EU64Y4.js +9 -0
- package/dist/bin/chunks/{chunk-CPL5P744.js → chunk-OKL2SPHK.js} +32 -32
- package/dist/bin/chunks/{chunk-6SAF32NO.js → chunk-VZKEP45B.js} +13 -13
- package/dist/bin/chunks/env-HOVBNLUR.js +2 -0
- package/dist/bin/chunks/{expansion-HLAOHDFJ.js → expansion-TCB3WZP5.js} +1 -1
- package/dist/bin/chunks/find-4YAO7JQS.js +2 -0
- package/dist/bin/chunks/flag-coverage-LQ37DA4R.js +2 -0
- package/dist/bin/chunks/{gzip-EENEW6WQ.js → gzip-RQ5RIFJV.js} +1 -1
- package/dist/bin/chunks/help-4H52JYYC.js +2 -0
- package/dist/bin/chunks/python3-74B25WCY.js +17 -0
- package/dist/bin/chunks/rg-34GE6REQ.js +2 -0
- package/dist/bin/{shell/chunks/sleep-RA6DYTJX.js → chunks/sleep-GUJH2AMQ.js} +1 -1
- package/dist/bin/chunks/sqlite3-57UI7HYL.js +2 -0
- package/dist/bin/chunks/{tar-GP2CCB47.js → tar-VIYVHMER.js} +1 -1
- package/dist/bin/chunks/time-FAWHHOMA.js +2 -0
- package/dist/bin/chunks/timeout-4O4YYRTS.js +2 -0
- package/dist/bin/chunks/worker.js +154 -4
- package/dist/bin/{shell/chunks/xargs-YWPEV2QC.js → chunks/xargs-GBL6PZ2K.js} +1 -1
- package/dist/bin/just-bash.js +255 -255
- package/dist/bin/shell/chunks/{awk2-YRDDZZBN.js → awk2-ZE5HJBNV.js} +1 -1
- package/dist/bin/shell/chunks/chunk-253LRF5J.js +11 -0
- package/dist/bin/shell/chunks/chunk-2BC3N3L2.js +16 -0
- package/dist/bin/shell/chunks/chunk-2FFXXW3F.js +14 -0
- package/dist/bin/shell/chunks/{chunk-D2VMRCQU.js → chunk-35JD7YEM.js} +12 -12
- package/dist/bin/shell/chunks/chunk-435ZOZCY.js +63 -0
- package/dist/bin/{chunks/chunk-JXC25GVQ.js → shell/chunks/chunk-47HZU3SY.js} +1 -1
- package/dist/bin/shell/chunks/chunk-4FNW6LFM.js +5 -0
- package/dist/bin/shell/chunks/chunk-4OALHZXB.js +2 -0
- package/dist/bin/shell/chunks/chunk-4PZYIYYG.js +36 -0
- package/dist/bin/shell/chunks/{chunk-HA4QZ6XJ.js → chunk-DREQRXNN.js} +4 -4
- package/dist/bin/shell/chunks/chunk-IYZRLSTQ.js +2 -0
- package/dist/bin/shell/chunks/chunk-JJHAWOIB.js +2 -0
- package/dist/bin/shell/chunks/{chunk-F37UEO7A.js → chunk-JNPUO56K.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-DAGNL3F2.js → chunk-MZKPWGID.js} +24 -24
- package/dist/bin/shell/chunks/chunk-N4EU64Y4.js +9 -0
- package/dist/bin/shell/chunks/{chunk-CPL5P744.js → chunk-OKL2SPHK.js} +32 -32
- package/dist/bin/shell/chunks/{chunk-6SAF32NO.js → chunk-VZKEP45B.js} +13 -13
- package/dist/bin/shell/chunks/env-HOVBNLUR.js +2 -0
- package/dist/bin/shell/chunks/{expansion-HLAOHDFJ.js → expansion-TCB3WZP5.js} +1 -1
- package/dist/bin/shell/chunks/find-4YAO7JQS.js +2 -0
- package/dist/bin/shell/chunks/flag-coverage-LQ37DA4R.js +2 -0
- package/dist/bin/shell/chunks/{gzip-EENEW6WQ.js → gzip-RQ5RIFJV.js} +1 -1
- package/dist/bin/shell/chunks/help-4H52JYYC.js +2 -0
- package/dist/bin/shell/chunks/python3-74B25WCY.js +17 -0
- package/dist/bin/shell/chunks/rg-34GE6REQ.js +2 -0
- package/dist/bin/{chunks/sleep-RA6DYTJX.js → shell/chunks/sleep-GUJH2AMQ.js} +1 -1
- package/dist/bin/shell/chunks/sqlite3-57UI7HYL.js +2 -0
- package/dist/bin/shell/chunks/{tar-GP2CCB47.js → tar-VIYVHMER.js} +1 -1
- package/dist/bin/shell/chunks/time-FAWHHOMA.js +2 -0
- package/dist/bin/shell/chunks/timeout-4O4YYRTS.js +2 -0
- package/dist/bin/{chunks/xargs-YWPEV2QC.js → shell/chunks/xargs-GBL6PZ2K.js} +1 -1
- package/dist/bin/shell/shell.js +252 -252
- package/dist/bundle/browser.js +748 -747
- package/dist/bundle/chunks/{awk2-66MVVLQI.js → awk2-T6LHPVZE.js} +1 -1
- package/dist/bundle/chunks/chunk-2GOYXRRP.js +15 -0
- package/dist/bundle/chunks/chunk-3RA5L262.js +8 -0
- package/dist/bundle/chunks/{chunk-CCCK5QHL.js → chunk-4VCAQZKQ.js} +32 -32
- package/dist/bundle/chunks/chunk-5CJQNRNJ.js +62 -0
- package/dist/bundle/chunks/{chunk-VFBZTF5G.js → chunk-7BQDVPII.js} +1 -1
- package/dist/bundle/chunks/chunk-7KHLIOOW.js +4 -0
- package/dist/bundle/chunks/{chunk-RARYJBGX.js → chunk-BAAVD5NO.js} +13 -13
- package/dist/bundle/chunks/chunk-BEFDX7IY.js +1 -0
- package/dist/bundle/chunks/{chunk-DZ33S2U7.js → chunk-FO655G4V.js} +24 -24
- package/dist/bundle/chunks/chunk-IPJHKYVM.js +1 -0
- package/dist/bundle/chunks/chunk-NBAARP4B.js +1 -0
- package/dist/bundle/chunks/{chunk-FJNVFD75.js → chunk-OKEHYWBE.js} +12 -12
- package/dist/bundle/chunks/chunk-RHOPHAL6.js +35 -0
- package/dist/bundle/chunks/{chunk-S7ED3RD5.js → chunk-UJIR5V54.js} +4 -4
- package/dist/bundle/chunks/chunk-YCABLDKV.js +10 -0
- package/dist/bundle/chunks/chunk-YIY2RKBW.js +13 -0
- package/dist/bundle/chunks/{chunk-SXR3EI72.js → chunk-ZSJYNBAF.js} +1 -1
- package/dist/bundle/chunks/env-XZY4LKEO.js +1 -0
- package/dist/bundle/chunks/{expansion-GY7U2FC2.js → expansion-HJ6B4DDG.js} +1 -1
- package/dist/bundle/chunks/find-DQFMWHAC.js +1 -0
- package/dist/bundle/chunks/{flag-coverage-25MQKYJJ.js → flag-coverage-MPLWXQQK.js} +1 -1
- package/dist/bundle/chunks/{gzip-UTSGNF5Z.js → gzip-Y4N2UKE7.js} +1 -1
- package/dist/bundle/chunks/help-IA5CMGR4.js +1 -0
- package/dist/bundle/chunks/python3-6BKA3FYA.js +16 -0
- package/dist/bundle/chunks/rg-RAICUFGG.js +1 -0
- package/dist/bundle/chunks/{sleep-RKLUWJ7F.js → sleep-LB7FI6AB.js} +1 -1
- package/dist/bundle/chunks/sqlite3-FVNA4KNF.js +1 -0
- package/dist/bundle/chunks/{tar-H6XTXOAP.js → tar-E2DVQEWO.js} +1 -1
- package/dist/bundle/chunks/time-AGNW2ZY6.js +1 -0
- package/dist/bundle/chunks/timeout-VN35D5O7.js +1 -0
- package/dist/bundle/chunks/worker.js +154 -4
- package/dist/bundle/chunks/{xargs-OGI2NN6J.js → xargs-2BBAQDTC.js} +1 -1
- package/dist/bundle/index.cjs +817 -815
- package/dist/bundle/index.js +263 -263
- package/dist/commands/python3/fs-bridge-handler.d.ts +5 -1
- package/dist/commands/sqlite3/sqlite3.d.ts +6 -0
- package/dist/commands/tar/tar-options.d.ts +1 -0
- package/dist/interpreter/helpers/result.d.ts +6 -0
- package/dist/interpreter/interpreter.d.ts +2 -0
- package/dist/interpreter/types.d.ts +2 -0
- package/dist/limits.d.ts +2 -0
- package/dist/network/types.d.ts +1 -1
- package/dist/sandbox/Command.d.ts +8 -1
- package/dist/sandbox/Sandbox.d.ts +1 -0
- package/dist/timers.d.ts +1 -0
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
- package/dist/bin/chunks/chunk-27KQPTIX.js +0 -36
- package/dist/bin/chunks/chunk-4QM2TCNV.js +0 -2
- package/dist/bin/chunks/chunk-5UH3Q7QT.js +0 -11
- package/dist/bin/chunks/chunk-KLMOJKL4.js +0 -16
- package/dist/bin/chunks/chunk-KTFEQPO7.js +0 -4
- package/dist/bin/chunks/chunk-N73TVRMN.js +0 -14
- package/dist/bin/chunks/chunk-QC46PWBQ.js +0 -63
- package/dist/bin/chunks/chunk-W2FKF3MM.js +0 -9
- package/dist/bin/chunks/chunk-WIWKAGK6.js +0 -2
- package/dist/bin/chunks/env-EVLPSWFF.js +0 -2
- package/dist/bin/chunks/find-PHHSZYDL.js +0 -2
- package/dist/bin/chunks/flag-coverage-GZCUF7B4.js +0 -2
- package/dist/bin/chunks/help-JF5TTAKQ.js +0 -2
- package/dist/bin/chunks/python3-XRP5IZRL.js +0 -16
- package/dist/bin/chunks/rg-EJJ3ILD5.js +0 -2
- package/dist/bin/chunks/sqlite3-2UNB5OLS.js +0 -2
- package/dist/bin/chunks/time-4C3A4THJ.js +0 -2
- package/dist/bin/chunks/timeout-QMKFLOWX.js +0 -2
- package/dist/bin/shell/chunks/chunk-27KQPTIX.js +0 -36
- package/dist/bin/shell/chunks/chunk-4QM2TCNV.js +0 -2
- package/dist/bin/shell/chunks/chunk-5UH3Q7QT.js +0 -11
- package/dist/bin/shell/chunks/chunk-KLMOJKL4.js +0 -16
- package/dist/bin/shell/chunks/chunk-KTFEQPO7.js +0 -4
- package/dist/bin/shell/chunks/chunk-N73TVRMN.js +0 -14
- package/dist/bin/shell/chunks/chunk-QC46PWBQ.js +0 -63
- package/dist/bin/shell/chunks/chunk-W2FKF3MM.js +0 -9
- package/dist/bin/shell/chunks/chunk-WIWKAGK6.js +0 -2
- package/dist/bin/shell/chunks/env-EVLPSWFF.js +0 -2
- package/dist/bin/shell/chunks/find-PHHSZYDL.js +0 -2
- package/dist/bin/shell/chunks/flag-coverage-GZCUF7B4.js +0 -2
- package/dist/bin/shell/chunks/help-JF5TTAKQ.js +0 -2
- package/dist/bin/shell/chunks/python3-XRP5IZRL.js +0 -16
- package/dist/bin/shell/chunks/rg-EJJ3ILD5.js +0 -2
- package/dist/bin/shell/chunks/sqlite3-2UNB5OLS.js +0 -2
- package/dist/bin/shell/chunks/time-4C3A4THJ.js +0 -2
- package/dist/bin/shell/chunks/timeout-QMKFLOWX.js +0 -2
- package/dist/bundle/chunks/chunk-73RYQHTW.js +0 -10
- package/dist/bundle/chunks/chunk-CSBFBYLD.js +0 -13
- package/dist/bundle/chunks/chunk-FPGA7RT4.js +0 -62
- package/dist/bundle/chunks/chunk-K4OVSVUA.js +0 -35
- package/dist/bundle/chunks/chunk-LEOLL6PF.js +0 -1
- package/dist/bundle/chunks/chunk-OGDTSM2Q.js +0 -8
- package/dist/bundle/chunks/chunk-R7KYILVY.js +0 -3
- package/dist/bundle/chunks/chunk-YYAPW4OA.js +0 -1
- package/dist/bundle/chunks/chunk-ZKLK6C7H.js +0 -15
- package/dist/bundle/chunks/env-S547XMN7.js +0 -1
- package/dist/bundle/chunks/find-6U6YYAEP.js +0 -1
- package/dist/bundle/chunks/help-T2NGLTSG.js +0 -1
- package/dist/bundle/chunks/python3-E7VF6UYO.js +0 -15
- package/dist/bundle/chunks/rg-4YNHHQAE.js +0 -1
- package/dist/bundle/chunks/sqlite3-TLIZUW3F.js +0 -1
- package/dist/bundle/chunks/time-BPT76IHZ.js +0 -1
- package/dist/bundle/chunks/timeout-QDZFJCOQ.js +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{b as p}from"./chunk-4FNW6LFM.js";import{a as j,b as h}from"./chunk-JJHAWOIB.js";import{a as S,b as y}from"./chunk-GTNBSMZR.js";import{existsSync as g}from"node:fs";import{dirname as W,join as w}from"node:path";import{fileURLToPath as H}from"node:url";import{Worker as J}from"node:worker_threads";import _ from"sql.js";function E(e,r,n){switch(n.mode){case"list":return M(e,r,n);case"csv":return V(e,r,n);case"json":return B(e,r);case"line":return O(e,r,n);case"column":return I(e,r,n);case"table":return N(e,r,n);case"markdown":return P(e,r,n);case"tabs":return R(e,r,n);case"box":return F(e,r,n);case"quote":return Q(e,r,n);case"html":return D(e,r,n);case"ascii":return U(e,r,n)}}function u(e,r){return e==null?r:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function M(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.join(n.separator));for(let a of r)t.push(a.map(i=>u(i,n.nullValue)).join(n.separator));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function V(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(x).join(","));for(let a of r)t.push(a.map(i=>x(u(i,n.nullValue))).join(","));return t.length>0?`${t.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`:""}function x(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
|
|
5
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function T(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function A(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):T(e):JSON.stringify(e)}function B(e,r){return r.length===0?"":`[${r.map(t=>`{${e.map((i,s)=>`${JSON.stringify(i)}:${A(t[s])}`).join(",")}}`).join(`,
|
|
6
|
+
`)}]
|
|
7
|
+
`}function O(e,r,n){if(e.length===0||r.length===0)return"";let t=Math.max(5,...e.map(i=>i.length)),a=[];for(let i of r)for(let s=0;s<e.length;s++){let o=e[s].padStart(t);a.push(`${o} = ${u(i[s],n.nullValue)}`)}return`${a.join(`
|
|
8
|
+
`)}
|
|
9
|
+
`}function I(e,r,n){if(e.length===0)return"";let t=e.map(i=>i.length);for(let i of r)for(let s=0;s<i.length;s++){let o=u(i[s],n.nullValue).length;o>t[s]&&(t[s]=o)}let a=[];n.header&&(a.push(e.map((i,s)=>i.padEnd(t[s])).join(" ")),a.push(t.map(i=>"-".repeat(i)).join(" ")));for(let i of r)a.push(i.map((s,o)=>u(s,n.nullValue).padEnd(t[o])).join(" "));return a.length>0?`${a.join(`
|
|
10
|
+
`)}
|
|
11
|
+
`:""}function N(e,r,n){if(e.length===0)return"";let t=e.map(s=>s.length);for(let s of r)for(let o=0;o<s.length;o++){let f=u(s[o],n.nullValue).length;f>t[o]&&(t[o]=f)}let a=[],i=`+${t.map(s=>"-".repeat(s+2)).join("+")}+`;a.push(i),n.header&&(a.push(`| ${e.map((s,o)=>s.padEnd(t[o])).join(" | ")} |`),a.push(i));for(let s of r)a.push(`| ${s.map((o,f)=>u(o,n.nullValue).padEnd(t[f])).join(" | ")} |`);return a.push(i),`${a.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`}function P(e,r,n){if(e.length===0)return"";let t=[];n.header&&(t.push(`| ${e.join(" | ")} |`),t.push(`|${e.map(()=>"---").join("|")}|`));for(let a of r)t.push(`| ${a.map(i=>u(i,n.nullValue)).join(" | ")} |`);return t.length>0?`${t.join(`
|
|
14
|
+
`)}
|
|
15
|
+
`:""}function R(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.join(" "));for(let a of r)t.push(a.map(i=>u(i,n.nullValue)).join(" "));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function F(e,r,n){if(e.length===0)return"";let t=e.map(i=>i.length);for(let i of r)for(let s=0;s<i.length;s++){let o=u(i[s],n.nullValue).length;o>t[s]&&(t[s]=o)}let a=[];a.push(`\u250C${t.map(i=>"\u2500".repeat(i+2)).join("\u252C")}\u2510`),a.push(`\u2502 ${e.map((i,s)=>i.padEnd(t[s])).join(" \u2502 ")} \u2502`),a.push(`\u251C${t.map(i=>"\u2500".repeat(i+2)).join("\u253C")}\u2524`);for(let i of r)a.push(`\u2502 ${i.map((s,o)=>u(s,n.nullValue).padEnd(t[o])).join(" \u2502 ")} \u2502`);return a.push(`\u2514${t.map(i=>"\u2500".repeat(i+2)).join("\u2534")}\u2518`),`${a.join(`
|
|
16
|
+
`)}
|
|
17
|
+
`}function Q(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(a=>`'${a}'`).join(","));for(let a of r)t.push(a.map(i=>i==null?"NULL":typeof i=="number"?Number.isInteger(i)?String(i):T(i):`'${String(i)}'`).join(","));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function D(e,r,n){let t=[];n.header&&e.length>0&&(t.push(`<TR>${e.map(a=>`<TH>${q(a)}</TH>`).join("")}`),t.push("</TR>"));for(let a of r)t.push(`<TR>${a.map(i=>`<TD>${q(u(i,n.nullValue))}</TD>`).join("")}`),t.push("</TR>");return t.length>0?`${t.join(`
|
|
18
|
+
`)}
|
|
19
|
+
`:""}function q(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function U(e,r,n){let i=[];n.header&&e.length>0&&i.push(e.join(""));for(let s of r)i.push(s.map(o=>u(o,n.nullValue)).join(""));return i.length>0?i.join("")+"":""}var z=5e3,X={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function Y(e){let r={mode:"list",header:!1,separator:"|",newline:`
|
|
20
|
+
`,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},n=null,t=null,a=!1,i=!1;for(let s=0;s<e.length;s++){let o=e[s];if(i){n===null?n=o:t===null&&(t=o);continue}if(o==="--")i=!0;else if(o==="-version")a=!0;else if(o==="-list")r.mode="list";else if(o==="-csv")r.mode="csv";else if(o==="-json")r.mode="json";else if(o==="-line")r.mode="line";else if(o==="-column")r.mode="column";else if(o==="-table")r.mode="table";else if(o==="-markdown")r.mode="markdown";else if(o==="-tabs")r.mode="tabs";else if(o==="-box")r.mode="box";else if(o==="-quote")r.mode="quote";else if(o==="-html")r.mode="html";else if(o==="-ascii")r.mode="ascii";else if(o==="-header")r.header=!0;else if(o==="-noheader")r.header=!1;else if(o==="-readonly")r.readonly=!0;else if(o==="-bail")r.bail=!0;else if(o==="-echo")r.echo=!0;else if(o==="-separator"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
|
|
21
|
+
`,exitCode:1};r.separator=e[++s]}else if(o==="-newline"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
|
|
22
|
+
`,exitCode:1};r.newline=e[++s]}else if(o==="-nullvalue"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
|
|
23
|
+
`,exitCode:1};r.nullValue=e[++s]}else if(o==="-cmd"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
|
|
24
|
+
`,exitCode:1};r.cmd=e[++s]}else{if(o.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${o.startsWith("--")?o.slice(1):o}
|
|
25
|
+
Use -help for a list of options.
|
|
26
|
+
`,exitCode:1};n===null?n=o:t===null&&(t=o)}}return{options:r,database:n,sql:t,showVersion:a}}async function v(){let e=await p.runTrustedAsync(()=>_()),r=new e.Database;try{let n=r.exec("SELECT sqlite_version()");return n.length>0&&n[0].values.length>0?String(n[0].values[0][0]):"unknown"}finally{r.close()}}function G(){let e=W(H(import.meta.url)),r=w(e,"../../commands/sqlite3/worker.js");if(g(r))return r;let n=w(e,"worker.js");if(g(n))return n;let t=w(e,"../../../dist/commands/sqlite3/worker.js");if(g(t))return t;throw new Error("sqlite3 worker not found. Run 'pnpm build' to compile the worker.")}var K={createWorker(e,r){return new J(e,{workerData:r})}};function Z(e){if(!e||typeof e!="object")return{success:!1,error:"Malformed worker response"};let r=e;return r.type==="security-violation"?{success:!1,error:`Security violation: ${typeof r.violation?.type=="string"?r.violation.type:"unknown"}`}:typeof r.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:r.success?Array.isArray(r.results)?typeof r.hasModifications!="boolean"?{success:!1,error:"Malformed worker response: missing hasModifications flag"}:r.dbBuffer!==null&&r.dbBuffer!==void 0&&!(r.dbBuffer instanceof Uint8Array)?{success:!1,error:"Malformed worker response: invalid dbBuffer"}:{success:!0,results:r.results,hasModifications:r.hasModifications,dbBuffer:r.dbBuffer===void 0?null:r.dbBuffer,defenseStats:r.defenseStats}:{success:!1,error:"Malformed worker response: missing results array"}:{success:!1,error:typeof r.error=="string"&&r.error.length>0?r.error:"Worker execution failed"}}async function ee(e,r){try{let n=G();return await new Promise((t,a)=>{let i=p.runTrusted(()=>K.createWorker(n,e)),s=j(()=>{i.terminate(),t({success:!1,error:`Query timeout: execution exceeded ${r}ms limit`})},r);i.on("message",o=>{h(s),t(Z(o))}),i.on("error",o=>{h(s),a(o)}),i.on("exit",o=>{h(s),o!==0&&t({success:!1,error:`Worker exited with code ${o}`})})})}catch(n){throw new Error(`sqlite3 worker failed to load: ${n.message}`)}}var de={name:"sqlite3",async execute(e,r){if(y(e)||e.includes("-help"))return S(X);let n=Y(e);if("exitCode"in n)return n;let{options:t,database:a,sql:i,showVersion:s}=n;if(s)return{stdout:`${await v()}
|
|
27
|
+
`,stderr:"",exitCode:0};if(!a)return{stdout:"",stderr:`sqlite3: missing database argument
|
|
28
|
+
`,exitCode:1};let o=i||r.stdin.trim();if(t.cmd&&(o=t.cmd+(o?`; ${o}`:"")),!o)return{stdout:"",stderr:`sqlite3: no SQL provided
|
|
29
|
+
`,exitCode:1};let f=a===":memory:",m="",b=null;try{f||(m=r.fs.resolvePath(r.cwd,a),await r.fs.exists(m)&&(b=await r.fs.readFileBuffer(m)))}catch(l){return{stdout:"",stderr:`sqlite3: unable to open database "${a}": ${l.message}
|
|
30
|
+
`,exitCode:1}}let C=r.limits?.maxSqliteTimeoutMs??z,k={dbBuffer:b,sql:o,options:{bail:t.bail,echo:t.echo}},d;try{d=await ee(k,C)}catch(l){return{stdout:"",stderr:`sqlite3: worker error: ${l.message}
|
|
31
|
+
`,exitCode:1}}if(!d.success)return{stdout:"",stderr:`sqlite3: ${d.error}
|
|
32
|
+
`,exitCode:1};let L={mode:t.mode,header:t.header,separator:t.separator,newline:t.newline,nullValue:t.nullValue},c="";t.echo&&(c+=`${o}
|
|
33
|
+
`);let $=!1;for(let l of d.results)if(l.type==="error"){if(t.bail)return{stdout:c,stderr:`Error: ${l.error}
|
|
34
|
+
`,exitCode:1};c+=`Error: ${l.error}
|
|
35
|
+
`,$=!0}else l.columns&&l.rows&&(l.rows.length>0||t.header)&&(c+=E(l.columns,l.rows,L));if(d.hasModifications&&!t.readonly&&!f&&m&&d.dbBuffer)try{await r.fs.writeFile(m,d.dbBuffer)}catch(l){return{stdout:c,stderr:`sqlite3: failed to write database: ${l.message}
|
|
36
|
+
`,exitCode:1}}return{stdout:c,stderr:"",exitCode:$&&t.bail?1:0}}},ce={name:"sqlite3",flags:[],needsArgs:!0};export{K as a,de as b,ce as c};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as c}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-4OALHZXB.js";import{a as c}from"./chunk-JJHAWOIB.js";import{a as g,b as p,c as a}from"./chunk-GTNBSMZR.js";var v={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
|
|
3
3
|
|
|
4
4
|
DURATION is a number with optional suffix:
|
|
5
5
|
s - seconds (default)
|
|
6
6
|
m - minutes
|
|
7
7
|
h - hours
|
|
8
|
-
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function
|
|
9
|
-
`,exitCode:1};let
|
|
8
|
+
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function w(r){let i=r.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!i)return null;let n=parseFloat(i[1]);switch(i[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var y={name:"timeout",async execute(r,i){if(p(r))return g(v);let n=!1,s=0;for(let t=0;t<r.length;t++){let e=r[t];if(e==="--preserve-status")n=!0,s=t+1;else if(e==="--foreground")s=t+1;else if(e==="-k"||e==="--kill-after")t++,s=t+1;else if(e.startsWith("--kill-after="))s=t+1;else if(e==="-s"||e==="--signal")t++,s=t+1;else if(e.startsWith("--signal="))s=t+1;else{if(e.startsWith("--")&&e!=="--")return a("timeout",e);if(e.startsWith("-")&&e.length>1&&e!=="--")if(e.startsWith("-k"))s=t+1;else if(e.startsWith("-s"))s=t+1;else return a("timeout",e);else{s=t;break}}}let o=r.slice(s);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
9
|
+
`,exitCode:1};let l=o[0],u=w(l);if(u===null)return{stdout:"",stderr:`timeout: invalid time interval '${l}'
|
|
10
10
|
`,exitCode:1};let m=o.slice(1);if(m.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
11
11
|
`,exitCode:1};if(!i.exec)return{stdout:"",stderr:`timeout: exec not available
|
|
12
|
-
`,exitCode:1};let h
|
|
12
|
+
`,exitCode:1};let A=h(m),d=new AbortController,x=new Promise(t=>{c(()=>{d.abort(),t({timedOut:!0})},u)}),O=i.exec(A,{cwd:i.cwd,signal:d.signal,stdin:i.stdin}).then(t=>({timedOut:!1,result:t})),f=await Promise.race([x,O]);return f.timedOut?{stdout:"",stderr:"",exitCode:124}:f.result}},D={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{y as a,D as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
function d(t){if(!t)return t;let e=t.replace(/\n\s+at\s.*/g,"");return e=e.replace(/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),e=e.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),e=e.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),e}import*as o from"node:fs";import*as r from"node:path";function y(t){if(!t||t==="/")return"/";let e=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;e.startsWith("/")||(e=`/${e}`);let n=e.split("/").filter(i=>i&&i!=="."),s=[];for(let i of n)i===".."?s.pop():s.push(i);return`/${s.join("/")}`||"/"}function f(t,e){return t===e||t.startsWith(`${e}/`)}function a(t,e){try{let n=o.realpathSync(t);return f(n,e)?n:null}catch(n){if(n.code==="ENOENT"){let s=r.dirname(t);if(s===t)return null;let i=a(s,e);if(i===null)return null;try{if(o.lstatSync(t).isSymbolicLink()){let l=o.readlinkSync(t),u=r.isAbsolute(l)?l:r.resolve(r.dirname(t),l);if(a(u,e)===null)return null}}catch{}return r.join(i,r.basename(t))}return null}}function v(t,e,n){let s=a(t,n);if(s===null)return null;let i=r.resolve(t),c=i.slice(e.length),l=s.slice(n.length);if(c!==l)return null;try{if(o.lstatSync(i).isSymbolicLink())return null}catch{}return s}function m(t,e){if(!o.existsSync(t))throw new Error(`${e} root does not exist`);if(!o.statSync(t).isDirectory())throw new Error(`${e} root is not a directory`)}function S(t,e){if(t.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${e} '${t}'`)}function x(t,e){if(!r.isAbsolute(t))return{withinRoot:!0,relativePath:t};let n;try{n=o.realpathSync(t)}catch{n=r.resolve(t)}return f(n,e)?{withinRoot:!0,relativePath:n.slice(e.length)||"/"}:{withinRoot:!1,safeName:r.basename(t)}}export{d as a,y as b,f as c,a as d,v as e,m as f,S as g,x as h};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b as o}from"./chunk-
|
|
2
|
+
import{a,b as o}from"./chunk-JJHAWOIB.js";import{a as i,b as l}from"./chunk-GTNBSMZR.js";var d={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
|
|
3
3
|
s - seconds (default)
|
|
4
4
|
m - minutes
|
|
5
5
|
h - hours
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as $}from"./chunk-JBABAK44.js";import{a as
|
|
2
|
+
import{a as $}from"./chunk-JBABAK44.js";import{a as z,b as w}from"./chunk-GTNBSMZR.js";import{constants as x,gunzipSync as F,gzipSync as S}from"node:zlib";var O={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
|
|
3
3
|
|
|
4
4
|
When no FILE is given, or when FILE is -, read from standard input.
|
|
5
5
|
|
|
6
|
-
With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},
|
|
6
|
+
With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},U={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place).
|
|
7
7
|
|
|
8
|
-
When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},
|
|
8
|
+
When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},D={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
|
|
9
9
|
|
|
10
|
-
When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},
|
|
11
|
-
`,exitCode:1};try{let
|
|
12
|
-
`,exitCode:1}}}else{let
|
|
10
|
+
When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},T={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function E(e){return e.best?x.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?x.Z_BEST_SPEED:x.Z_DEFAULT_COMPRESSION}function k(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],o=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let n=e[r]|e[r+1]<<8;r+=2+n}let s=null;if(t&8){let n=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(s=new TextDecoder().decode(e.slice(n,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:s,mtime:o>0?new Date(o*1e3):null,headerSize:r}}function q(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function b(e){return e.length>=2&&e[0]===31&&e[1]===139}function m(e){return Buffer.from(e).toString("latin1")}function I(e){return e.limits?.maxOutputSize??0}function v(e,t){if(t>0){if(q(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);return F(e,{maxOutputLength:t})}return F(e)}async function L(e,t,o,r,s,n){let d=o.suffix,f,p,a,c=I(e);if(t==="-"||t==="")if(a=Uint8Array.from(e.stdin,i=>i.charCodeAt(0)),s){if(!b(a))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
|
|
11
|
+
`,exitCode:1};try{let i=v(a,c);return{stdout:m(i),stderr:"",exitCode:0}}catch(i){let l=i instanceof Error?i.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${l}
|
|
12
|
+
`,exitCode:1}}}else{let i=E(o),l=S(a,{level:i});return{stdout:m(l),stderr:"",exitCode:0}}f=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(f)).isDirectory)return o.recursive?await P(e,f,o,r,s,n):o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
|
|
13
13
|
`,exitCode:1}}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
14
14
|
`,exitCode:1}}try{a=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
15
|
-
`,exitCode:1}}if(s){if(!t.endsWith(
|
|
16
|
-
`,exitCode:1};if(!
|
|
17
|
-
`,exitCode:1};let
|
|
18
|
-
`,exitCode:1}}if(n)return{stdout:
|
|
19
|
-
`,exitCode:1}}catch{}if(await e.fs.writeFile(p,
|
|
20
|
-
`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(
|
|
21
|
-
`,exitCode:1};let
|
|
22
|
-
`,exitCode:1}}if(n)return{stdout:
|
|
23
|
-
`,exitCode:1}}catch{}if(await e.fs.writeFile(p,
|
|
24
|
-
`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function
|
|
25
|
-
`,exitCode:1}}}if(!
|
|
26
|
-
`,exitCode:1};let n=s.length,
|
|
27
|
-
`,stderr:"",exitCode:0}}async function
|
|
28
|
-
`,exitCode:1}}}if(!
|
|
29
|
-
`,exitCode:1};try{return
|
|
30
|
-
`,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(n){let
|
|
31
|
-
`,exitCode:1}}}async function
|
|
32
|
-
`,
|
|
15
|
+
`,exitCode:1}}if(s){if(!t.endsWith(d))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
|
|
16
|
+
`,exitCode:1};if(!b(a))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
|
|
17
|
+
`,exitCode:1};let i;try{i=v(a,c)}catch(l){let u=l instanceof Error?l.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${u}
|
|
18
|
+
`,exitCode:1}}if(n)return{stdout:m(i),stderr:"",exitCode:0};if(o.name){let l=k(a);l.originalName?p=e.fs.resolvePath(e.cwd,l.originalName):p=f.slice(0,-d.length)}else p=f.slice(0,-d.length);if(!o.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${r}: ${p} already exists; not overwritten
|
|
19
|
+
`,exitCode:1}}catch{}if(await e.fs.writeFile(p,i),!o.keep&&!n&&await e.fs.rm(f),o.verbose){let l=a.length>0?((1-a.length/i.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${l}% -- replaced with ${p.split("/").pop()}
|
|
20
|
+
`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(d))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t} already has ${d} suffix -- unchanged
|
|
21
|
+
`,exitCode:1};let i=E(o),l;try{l=S(a,{level:i})}catch(u){let g=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${g}
|
|
22
|
+
`,exitCode:1}}if(n)return{stdout:m(l),stderr:"",exitCode:0};if(p=f+d,!o.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${r}: ${p} already exists; not overwritten
|
|
23
|
+
`,exitCode:1}}catch{}if(await e.fs.writeFile(p,l),!o.keep&&!n&&await e.fs.rm(f),o.verbose){let u=a.length>0?((1-l.length/a.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${u}% -- replaced with ${p.split("/").pop()}
|
|
24
|
+
`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function P(e,t,o,r,s,n){let d=await e.fs.readdir(t),f="",p="",a=0;for(let c of d){let i=e.fs.resolvePath(t,c),l=await e.fs.stat(i);if(l.isDirectory){let u=await P(e,i,o,r,s,n);f+=u.stdout,p+=u.stderr,u.exitCode!==0&&(a=u.exitCode)}else if(l.isFile){let u=o.suffix;if(s&&!c.endsWith(u)||!s&&c.endsWith(u))continue;let g=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,y=await L(e,g,o,r,s,n);f+=y.stdout,p+=y.stderr,y.exitCode!==0&&(a=y.exitCode)}}return{stdout:f,stderr:p,exitCode:a}}async function W(e,t,o,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
25
|
+
`,exitCode:1}}}if(!b(s))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
|
|
26
|
+
`,exitCode:1};let n=s.length,d=q(s),f=d>0?((1-n/d)*100).toFixed(1):"0.0",a=k(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${n.toString().padStart(10)} ${d.toString().padStart(10)} ${f.padStart(5)}% ${a}
|
|
27
|
+
`,stderr:"",exitCode:0}}async function A(e,t,o,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,n=>n.charCodeAt(0));else{let n=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(n)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
28
|
+
`,exitCode:1}}}if(!b(s))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
|
|
29
|
+
`,exitCode:1};try{return v(s,I(e)),o.verbose?{stdout:"",stderr:`${t}: OK
|
|
30
|
+
`,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(n){let d=n instanceof Error?n.message:"invalid";return{stdout:"",stderr:`${r}: ${t}: ${d}
|
|
31
|
+
`,exitCode:1}}}async function C(e,t,o){let r=o==="zcat"?D:o==="gunzip"?U:O;if(w(e))return z(r);let s=$(o,e,T);if(!s.ok)return s.error.stderr.includes("unrecognized option"),s.error;let n=s.result.flags,d=s.result.positional,f=o==="gunzip"||o==="zcat"||n.decompress||n.uncompress,p=o==="zcat"||n.stdout||n.toStdout;if(n.list){d.length===0&&(d=["-"]);let l=` compressed uncompressed ratio uncompressed_name
|
|
32
|
+
`,u="",g=0;for(let y of d){let h=await W(t,y,n,o);l+=h.stdout,u+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:l,stderr:u,exitCode:g}}if(n.test){d.length===0&&(d=["-"]);let l="",u="",g=0;for(let y of d){let h=await A(t,y,n,o);l+=h.stdout,u+=h.stderr,h.exitCode!==0&&(g=h.exitCode)}return{stdout:l,stderr:u,exitCode:g}}d.length===0&&(d=["-"]);let a="",c="",i=0;for(let l of d){let u=await L(t,l,n,o,f,p);a+=u.stdout,c+=u.stderr,u.exitCode!==0&&(i=u.exitCode)}return{stdout:a,stderr:c,exitCode:i}}var G={name:"gzip",async execute(e,t){return C(e,t,"gzip")}},M={name:"gunzip",async execute(e,t){return C(e,t,"gunzip")}},Z={name:"zcat",async execute(e,t){return C(e,t,"zcat")}},R={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},K={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},j={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0};export{G as a,M as b,Z as c,R as d,K as e,j as f};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as v}from"./chunk-4OALHZXB.js";import{a as d}from"./chunk-4PRVMER6.js";import{a as c,b as m,c as f}from"./chunk-GTNBSMZR.js";var y={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},N={name:"env",async execute(o,i){if(m(o))return c(y);let a=!1,r=[],u=new Map,t=-1;for(let n=0;n<o.length;n++){let e=o[n];if(e==="-i"||e==="--ignore-environment")a=!0;else if(e==="-u"&&n+1<o.length)r.push(o[++n]);else if(e.startsWith("-u"))r.push(e.slice(2));else if(e.startsWith("--unset="))r.push(e.slice(8));else{if(e.startsWith("--")&&e!=="--")return f("env",e);if(e.startsWith("-")&&e!=="-"){for(let l of e.slice(1))if(l!=="i"&&l!=="u")return f("env",`-${l}`);e.includes("i")&&(a=!0)}else if(e.includes("=")&&t===-1){let l=e.indexOf("="),g=e.slice(0,l),x=e.slice(l+1);u.set(g,x)}else{t=n;break}}}let s;if(a)s=new Map(u);else{s=new Map(i.env);for(let n of r)s.delete(n);for(let[n,e]of u)s.set(n,e)}if(t===-1){let n=[];for(let[e,l]of s)n.push(`${e}=${l}`);return{stdout:n.join(`
|
|
3
|
+
`)+(n.length>0?`
|
|
4
|
+
`:""),stderr:"",exitCode:0}}if(!i.exec)return{stdout:"",stderr:`env: command execution not supported in this context
|
|
5
|
+
`,exitCode:1};let p=o.slice(t),h=v(["command",...p]);return i.exec(h,{cwd:i.cwd,env:d(s),replaceEnv:!0,stdin:i.stdin,signal:i.signal})}},A={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},C={name:"printenv",async execute(o,i){if(m(o))return c(A);let a=o.filter(t=>!t.startsWith("-"));if(a.length===0){let t=[];for(let[s,p]of i.env)t.push(`${s}=${p}`);return{stdout:t.join(`
|
|
6
|
+
`)+(t.length>0?`
|
|
7
|
+
`:""),stderr:"",exitCode:0}}let r=[],u=0;for(let t of a){let s=i.env.get(t);s!==void 0?r.push(s):u=1}return{stdout:r.join(`
|
|
8
|
+
`)+(r.length>0?`
|
|
9
|
+
`:""),stderr:"",exitCode:u}}},O={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},F={name:"printenv",flags:[]};export{N as a,C as b,O as c,F as d};
|