just-binary 2.9.8
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/LICENSE +201 -0
- package/README.md +458 -0
- package/dist/AGENTS.md +323 -0
- package/dist/Bash.d.ts +179 -0
- package/dist/ast/types.d.ts +615 -0
- package/dist/banned-patterns-test.d.ts +8 -0
- package/dist/bin/chunks/alias-23G4Q2RS.js +2 -0
- package/dist/bin/chunks/awk2-Z6VRXKAK.js +2 -0
- package/dist/bin/chunks/base64-DNX4WCIO.js +2 -0
- package/dist/bin/chunks/basename-MPQ7M4RF.js +2 -0
- package/dist/bin/chunks/bash-OQ32Y5I6.js +2 -0
- package/dist/bin/chunks/bytes-6YUZMX3P.js +2 -0
- package/dist/bin/chunks/cat-CL5ISR5P.js +2 -0
- package/dist/bin/chunks/chmod-R6IWRSKZ.js +2 -0
- package/dist/bin/chunks/chunk-227L3ACM.js +23 -0
- package/dist/bin/chunks/chunk-2QA4P6HI.js +12 -0
- package/dist/bin/chunks/chunk-3MFM4GSH.js +36 -0
- package/dist/bin/chunks/chunk-3UP5LXDO.js +3 -0
- package/dist/bin/chunks/chunk-47P7JSQI.js +2 -0
- package/dist/bin/chunks/chunk-4KBTPDQB.js +3 -0
- package/dist/bin/chunks/chunk-4UK2MV3F.js +13 -0
- package/dist/bin/chunks/chunk-4VDEBYW7.js +2 -0
- package/dist/bin/chunks/chunk-563AO4OL.js +7 -0
- package/dist/bin/chunks/chunk-5HDWUXRX.js +7 -0
- package/dist/bin/chunks/chunk-5MCFI6LE.js +5 -0
- package/dist/bin/chunks/chunk-6CZOPIZD.js +6 -0
- package/dist/bin/chunks/chunk-6FNFX5GG.js +5 -0
- package/dist/bin/chunks/chunk-6NYIHYDY.js +7 -0
- package/dist/bin/chunks/chunk-6Y4TKR73.js +16 -0
- package/dist/bin/chunks/chunk-7C7WEK46.js +23 -0
- package/dist/bin/chunks/chunk-7TNGQWY6.js +6 -0
- package/dist/bin/chunks/chunk-7UAWRBQS.js +9 -0
- package/dist/bin/chunks/chunk-ARGU3OIG.js +17 -0
- package/dist/bin/chunks/chunk-BA3A5BYZ.js +3 -0
- package/dist/bin/chunks/chunk-BB7T22CF.js +140 -0
- package/dist/bin/chunks/chunk-BY24LKGP.js +8 -0
- package/dist/bin/chunks/chunk-CRHN4WNQ.js +63 -0
- package/dist/bin/chunks/chunk-ELZHJGI7.js +10 -0
- package/dist/bin/chunks/chunk-F46CSMUF.js +2 -0
- package/dist/bin/chunks/chunk-FQX4G5RH.js +7 -0
- package/dist/bin/chunks/chunk-G43H2WGH.js +17 -0
- package/dist/bin/chunks/chunk-GIFF636B.js +2 -0
- package/dist/bin/chunks/chunk-GMJWC3MC.js +12 -0
- package/dist/bin/chunks/chunk-HVDU57EV.js +16 -0
- package/dist/bin/chunks/chunk-HWGK3XW7.js +6 -0
- package/dist/bin/chunks/chunk-HYR7G7KS.js +3 -0
- package/dist/bin/chunks/chunk-I2225JSU.js +14 -0
- package/dist/bin/chunks/chunk-I2FUQZXU.js +11 -0
- package/dist/bin/chunks/chunk-IBHPKKIT.js +10 -0
- package/dist/bin/chunks/chunk-IKNNFJNZ.js +14 -0
- package/dist/bin/chunks/chunk-INPUJM7Y.js +8 -0
- package/dist/bin/chunks/chunk-IOBKPMWJ.js +9 -0
- package/dist/bin/chunks/chunk-IYSA2L6A.js +13 -0
- package/dist/bin/chunks/chunk-JMLNX7GE.js +287 -0
- package/dist/bin/chunks/chunk-K2K4KPOQ.js +3 -0
- package/dist/bin/chunks/chunk-K6DD7NH3.js +9 -0
- package/dist/bin/chunks/chunk-KFLJ4EMB.js +4 -0
- package/dist/bin/chunks/chunk-KOMDAXHM.js +7 -0
- package/dist/bin/chunks/chunk-KV7ZTM2R.js +11 -0
- package/dist/bin/chunks/chunk-LCCVVEJA.js +10 -0
- package/dist/bin/chunks/chunk-LUPJK5US.js +84 -0
- package/dist/bin/chunks/chunk-LWF3XDOC.js +32 -0
- package/dist/bin/chunks/chunk-LXNARM2C.js +9 -0
- package/dist/bin/chunks/chunk-LXZS3X5T.js +9 -0
- package/dist/bin/chunks/chunk-M4ICSCXT.js +100 -0
- package/dist/bin/chunks/chunk-MEBZXRGE.js +5 -0
- package/dist/bin/chunks/chunk-MSPSS36S.js +16 -0
- package/dist/bin/chunks/chunk-N335RIGZ.js +20 -0
- package/dist/bin/chunks/chunk-N5KGQWJH.js +5 -0
- package/dist/bin/chunks/chunk-NDHTQE5T.js +8 -0
- package/dist/bin/chunks/chunk-NF5G7X3O.js +7 -0
- package/dist/bin/chunks/chunk-NGKNJ6V2.js +11 -0
- package/dist/bin/chunks/chunk-OBH7XN5N.js +1 -0
- package/dist/bin/chunks/chunk-OKQ6RACF.js +73 -0
- package/dist/bin/chunks/chunk-PBY7XGZ6.js +8 -0
- package/dist/bin/chunks/chunk-PHHNNFRS.js +6 -0
- package/dist/bin/chunks/chunk-PO6Y7TWQ.js +6 -0
- package/dist/bin/chunks/chunk-Q4TLKLIZ.js +12 -0
- package/dist/bin/chunks/chunk-QS6LP3E3.js +6 -0
- package/dist/bin/chunks/chunk-QT2GMJRJ.js +8 -0
- package/dist/bin/chunks/chunk-QUVW3R4I.js +5 -0
- package/dist/bin/chunks/chunk-QUYWT2TY.js +21 -0
- package/dist/bin/chunks/chunk-QWUII542.js +2 -0
- package/dist/bin/chunks/chunk-R5EQDD5Y.js +13 -0
- package/dist/bin/chunks/chunk-RQSPCXDR.js +2 -0
- package/dist/bin/chunks/chunk-RTC6C5QW.js +2 -0
- package/dist/bin/chunks/chunk-S5W2KVHC.js +2 -0
- package/dist/bin/chunks/chunk-SDXDICI4.js +2 -0
- package/dist/bin/chunks/chunk-SE4C7FJY.js +33 -0
- package/dist/bin/chunks/chunk-SX7TI7Q2.js +3 -0
- package/dist/bin/chunks/chunk-TDJ55L4A.js +16 -0
- package/dist/bin/chunks/chunk-TNPUAMV3.js +8 -0
- package/dist/bin/chunks/chunk-TSGSFBQI.js +14 -0
- package/dist/bin/chunks/chunk-U5ZE562V.js +2 -0
- package/dist/bin/chunks/chunk-UIMH6I3G.js +33 -0
- package/dist/bin/chunks/chunk-UXPY5T2P.js +9 -0
- package/dist/bin/chunks/chunk-UYBH3FNE.js +2 -0
- package/dist/bin/chunks/chunk-V5I6PHN2.js +14 -0
- package/dist/bin/chunks/chunk-VOTJNR36.js +5 -0
- package/dist/bin/chunks/chunk-W5XFREQC.js +3 -0
- package/dist/bin/chunks/chunk-X2MOXVGO.js +26 -0
- package/dist/bin/chunks/chunk-XOGQUO62.js +2 -0
- package/dist/bin/chunks/chunk-Y57BDPQ5.js +6 -0
- package/dist/bin/chunks/chunk-YE6KXFFU.js +2 -0
- package/dist/bin/chunks/chunk-YEPWKN4F.js +3 -0
- package/dist/bin/chunks/chunk-ZEDWVSUZ.js +19 -0
- package/dist/bin/chunks/chunk-ZI4TTZL5.js +21 -0
- package/dist/bin/chunks/chunk-ZZVIGHYS.js +7 -0
- package/dist/bin/chunks/clear-27OP2FQZ.js +2 -0
- package/dist/bin/chunks/column-FJNKONCJ.js +2 -0
- package/dist/bin/chunks/comm-5FNEJE7X.js +2 -0
- package/dist/bin/chunks/cp-LVKHKFHQ.js +2 -0
- package/dist/bin/chunks/curl-S4FJSZA5.js +26 -0
- package/dist/bin/chunks/cut-UXU6PNTT.js +2 -0
- package/dist/bin/chunks/date-GGPTXVUT.js +2 -0
- package/dist/bin/chunks/diff-3V3FOITV.js +2 -0
- package/dist/bin/chunks/dirname-455JDV2M.js +2 -0
- package/dist/bin/chunks/du-WUEAQO2W.js +2 -0
- package/dist/bin/chunks/echo-HBXOI5TQ.js +2 -0
- package/dist/bin/chunks/env-MXFHTVHS.js +2 -0
- package/dist/bin/chunks/expand-F4FM4ML2.js +2 -0
- package/dist/bin/chunks/expansion-7AYBVOIQ.js +2 -0
- package/dist/bin/chunks/expr-5ZKR5ER5.js +2 -0
- package/dist/bin/chunks/file-BFN7BKUR.js +2 -0
- package/dist/bin/chunks/find-W4BCEJEC.js +2 -0
- package/dist/bin/chunks/flag-coverage-DBKGNLJO.js +2 -0
- package/dist/bin/chunks/fold-AE57YLOS.js +2 -0
- package/dist/bin/chunks/grep-I63BWUKL.js +2 -0
- package/dist/bin/chunks/gzip-X5IDXWZE.js +2 -0
- package/dist/bin/chunks/head-TBQETLQX.js +2 -0
- package/dist/bin/chunks/help-HGMKZ2GW.js +2 -0
- package/dist/bin/chunks/history-2DYRIL3U.js +2 -0
- package/dist/bin/chunks/hostname-RWEPTCXH.js +2 -0
- package/dist/bin/chunks/html-to-markdown-2VQWCEKU.js +2 -0
- package/dist/bin/chunks/join-TRRWQBEU.js +2 -0
- package/dist/bin/chunks/jq-NFKKH27D.js +2 -0
- package/dist/bin/chunks/ln-BSEVUP2J.js +2 -0
- package/dist/bin/chunks/ls-IJLTWVOI.js +2 -0
- package/dist/bin/chunks/md5sum-ZIQHOC4K.js +2 -0
- package/dist/bin/chunks/mkdir-KYFAO2SF.js +2 -0
- package/dist/bin/chunks/mv-TWM2PA7Q.js +2 -0
- package/dist/bin/chunks/nl-XLF2HFST.js +2 -0
- package/dist/bin/chunks/od-BOM6JPTH.js +2 -0
- package/dist/bin/chunks/paste-FUGXVGJX.js +2 -0
- package/dist/bin/chunks/printf-XUGNJ3QM.js +2 -0
- package/dist/bin/chunks/pwd-RZG6GZEU.js +2 -0
- package/dist/bin/chunks/python3-PIXJS3YM.js +14 -0
- package/dist/bin/chunks/readlink-4SOSIDHE.js +2 -0
- package/dist/bin/chunks/rev-5E5UGSUZ.js +2 -0
- package/dist/bin/chunks/rg-4YJSQZN7.js +2 -0
- package/dist/bin/chunks/rm-3PFOF4E3.js +2 -0
- package/dist/bin/chunks/rmdir-CSK7CGH5.js +2 -0
- package/dist/bin/chunks/sed-XBCUZMEP.js +2 -0
- package/dist/bin/chunks/seq-H7ID4VMK.js +2 -0
- package/dist/bin/chunks/sha1sum-EDQNYXXH.js +2 -0
- package/dist/bin/chunks/sha256sum-APTG6DO2.js +2 -0
- package/dist/bin/chunks/sleep-PNT7KILS.js +2 -0
- package/dist/bin/chunks/sort-ELAGZUES.js +2 -0
- package/dist/bin/chunks/split-QGXYUWBC.js +2 -0
- package/dist/bin/chunks/sqlite3-ELLMKNNJ.js +2 -0
- package/dist/bin/chunks/stat-Q2TZRKO3.js +2 -0
- package/dist/bin/chunks/strings-IGEGP5QX.js +2 -0
- package/dist/bin/chunks/tac-VOEDJLLG.js +2 -0
- package/dist/bin/chunks/tail-JOQASWMV.js +2 -0
- package/dist/bin/chunks/tar-2UVSVD3P.js +2 -0
- package/dist/bin/chunks/tee-IQLEDZOQ.js +2 -0
- package/dist/bin/chunks/time-VRCJK2LI.js +2 -0
- package/dist/bin/chunks/timeout-A36YWZWR.js +2 -0
- package/dist/bin/chunks/touch-5ECNQNBP.js +2 -0
- package/dist/bin/chunks/tr-AVALLN54.js +2 -0
- package/dist/bin/chunks/tree-UFM5EDXS.js +2 -0
- package/dist/bin/chunks/true-BU5JSAAW.js +2 -0
- package/dist/bin/chunks/unexpand-TDRWZW5F.js +2 -0
- package/dist/bin/chunks/uniq-IKBUNAMN.js +2 -0
- package/dist/bin/chunks/wc-2R4RS2SX.js +2 -0
- package/dist/bin/chunks/which-6UVGMXDF.js +2 -0
- package/dist/bin/chunks/whoami-N6TLTETT.js +2 -0
- package/dist/bin/chunks/worker.js +2260 -0
- package/dist/bin/chunks/xan-JX5QUK32.js +2 -0
- package/dist/bin/chunks/xan-view-NFMUMJ7Z.js +2 -0
- package/dist/bin/chunks/xargs-4MYN4U3C.js +2 -0
- package/dist/bin/chunks/yq-EHDQVD7S.js +2 -0
- package/dist/bin/just-bash.js +732 -0
- package/dist/bin/shell/chunks/alias-23G4Q2RS.js +2 -0
- package/dist/bin/shell/chunks/awk2-Z6VRXKAK.js +2 -0
- package/dist/bin/shell/chunks/base64-DNX4WCIO.js +2 -0
- package/dist/bin/shell/chunks/basename-MPQ7M4RF.js +2 -0
- package/dist/bin/shell/chunks/bash-OQ32Y5I6.js +2 -0
- package/dist/bin/shell/chunks/bytes-6YUZMX3P.js +2 -0
- package/dist/bin/shell/chunks/cat-CL5ISR5P.js +2 -0
- package/dist/bin/shell/chunks/chmod-R6IWRSKZ.js +2 -0
- package/dist/bin/shell/chunks/chunk-227L3ACM.js +23 -0
- package/dist/bin/shell/chunks/chunk-2QA4P6HI.js +12 -0
- package/dist/bin/shell/chunks/chunk-3MFM4GSH.js +36 -0
- package/dist/bin/shell/chunks/chunk-3UP5LXDO.js +3 -0
- package/dist/bin/shell/chunks/chunk-47P7JSQI.js +2 -0
- package/dist/bin/shell/chunks/chunk-4KBTPDQB.js +3 -0
- package/dist/bin/shell/chunks/chunk-4UK2MV3F.js +13 -0
- package/dist/bin/shell/chunks/chunk-4VDEBYW7.js +2 -0
- package/dist/bin/shell/chunks/chunk-563AO4OL.js +7 -0
- package/dist/bin/shell/chunks/chunk-5HDWUXRX.js +7 -0
- package/dist/bin/shell/chunks/chunk-5MCFI6LE.js +5 -0
- package/dist/bin/shell/chunks/chunk-6CZOPIZD.js +6 -0
- package/dist/bin/shell/chunks/chunk-6FNFX5GG.js +5 -0
- package/dist/bin/shell/chunks/chunk-6NYIHYDY.js +7 -0
- package/dist/bin/shell/chunks/chunk-6Y4TKR73.js +16 -0
- package/dist/bin/shell/chunks/chunk-7C7WEK46.js +23 -0
- package/dist/bin/shell/chunks/chunk-7TNGQWY6.js +6 -0
- package/dist/bin/shell/chunks/chunk-7UAWRBQS.js +9 -0
- package/dist/bin/shell/chunks/chunk-ARGU3OIG.js +17 -0
- package/dist/bin/shell/chunks/chunk-BA3A5BYZ.js +3 -0
- package/dist/bin/shell/chunks/chunk-BB7T22CF.js +140 -0
- package/dist/bin/shell/chunks/chunk-BY24LKGP.js +8 -0
- package/dist/bin/shell/chunks/chunk-CRHN4WNQ.js +63 -0
- package/dist/bin/shell/chunks/chunk-ELZHJGI7.js +10 -0
- package/dist/bin/shell/chunks/chunk-F46CSMUF.js +2 -0
- package/dist/bin/shell/chunks/chunk-FQX4G5RH.js +7 -0
- package/dist/bin/shell/chunks/chunk-G43H2WGH.js +17 -0
- package/dist/bin/shell/chunks/chunk-GIFF636B.js +2 -0
- package/dist/bin/shell/chunks/chunk-GMJWC3MC.js +12 -0
- package/dist/bin/shell/chunks/chunk-HVDU57EV.js +16 -0
- package/dist/bin/shell/chunks/chunk-HWGK3XW7.js +6 -0
- package/dist/bin/shell/chunks/chunk-HYR7G7KS.js +3 -0
- package/dist/bin/shell/chunks/chunk-I2225JSU.js +14 -0
- package/dist/bin/shell/chunks/chunk-I2FUQZXU.js +11 -0
- package/dist/bin/shell/chunks/chunk-IBHPKKIT.js +10 -0
- package/dist/bin/shell/chunks/chunk-IKNNFJNZ.js +14 -0
- package/dist/bin/shell/chunks/chunk-INPUJM7Y.js +8 -0
- package/dist/bin/shell/chunks/chunk-IOBKPMWJ.js +9 -0
- package/dist/bin/shell/chunks/chunk-IYSA2L6A.js +13 -0
- package/dist/bin/shell/chunks/chunk-JMLNX7GE.js +287 -0
- package/dist/bin/shell/chunks/chunk-K2K4KPOQ.js +3 -0
- package/dist/bin/shell/chunks/chunk-K6DD7NH3.js +9 -0
- package/dist/bin/shell/chunks/chunk-KFLJ4EMB.js +4 -0
- package/dist/bin/shell/chunks/chunk-KOMDAXHM.js +7 -0
- package/dist/bin/shell/chunks/chunk-KV7ZTM2R.js +11 -0
- package/dist/bin/shell/chunks/chunk-LCCVVEJA.js +10 -0
- package/dist/bin/shell/chunks/chunk-LUPJK5US.js +84 -0
- package/dist/bin/shell/chunks/chunk-LWF3XDOC.js +32 -0
- package/dist/bin/shell/chunks/chunk-LXNARM2C.js +9 -0
- package/dist/bin/shell/chunks/chunk-LXZS3X5T.js +9 -0
- package/dist/bin/shell/chunks/chunk-M4ICSCXT.js +100 -0
- package/dist/bin/shell/chunks/chunk-MEBZXRGE.js +5 -0
- package/dist/bin/shell/chunks/chunk-MSPSS36S.js +16 -0
- package/dist/bin/shell/chunks/chunk-N335RIGZ.js +20 -0
- package/dist/bin/shell/chunks/chunk-N5KGQWJH.js +5 -0
- package/dist/bin/shell/chunks/chunk-NDHTQE5T.js +8 -0
- package/dist/bin/shell/chunks/chunk-NF5G7X3O.js +7 -0
- package/dist/bin/shell/chunks/chunk-NGKNJ6V2.js +11 -0
- package/dist/bin/shell/chunks/chunk-OBH7XN5N.js +1 -0
- package/dist/bin/shell/chunks/chunk-OKQ6RACF.js +73 -0
- package/dist/bin/shell/chunks/chunk-PBY7XGZ6.js +8 -0
- package/dist/bin/shell/chunks/chunk-PHHNNFRS.js +6 -0
- package/dist/bin/shell/chunks/chunk-PO6Y7TWQ.js +6 -0
- package/dist/bin/shell/chunks/chunk-Q4TLKLIZ.js +12 -0
- package/dist/bin/shell/chunks/chunk-QS6LP3E3.js +6 -0
- package/dist/bin/shell/chunks/chunk-QT2GMJRJ.js +8 -0
- package/dist/bin/shell/chunks/chunk-QUVW3R4I.js +5 -0
- package/dist/bin/shell/chunks/chunk-QUYWT2TY.js +21 -0
- package/dist/bin/shell/chunks/chunk-QWUII542.js +2 -0
- package/dist/bin/shell/chunks/chunk-R5EQDD5Y.js +13 -0
- package/dist/bin/shell/chunks/chunk-RQSPCXDR.js +2 -0
- package/dist/bin/shell/chunks/chunk-RTC6C5QW.js +2 -0
- package/dist/bin/shell/chunks/chunk-S5W2KVHC.js +2 -0
- package/dist/bin/shell/chunks/chunk-SDXDICI4.js +2 -0
- package/dist/bin/shell/chunks/chunk-SE4C7FJY.js +33 -0
- package/dist/bin/shell/chunks/chunk-SX7TI7Q2.js +3 -0
- package/dist/bin/shell/chunks/chunk-TDJ55L4A.js +16 -0
- package/dist/bin/shell/chunks/chunk-TNPUAMV3.js +8 -0
- package/dist/bin/shell/chunks/chunk-TSGSFBQI.js +14 -0
- package/dist/bin/shell/chunks/chunk-U5ZE562V.js +2 -0
- package/dist/bin/shell/chunks/chunk-UIMH6I3G.js +33 -0
- package/dist/bin/shell/chunks/chunk-UXPY5T2P.js +9 -0
- package/dist/bin/shell/chunks/chunk-UYBH3FNE.js +2 -0
- package/dist/bin/shell/chunks/chunk-V5I6PHN2.js +14 -0
- package/dist/bin/shell/chunks/chunk-VOTJNR36.js +5 -0
- package/dist/bin/shell/chunks/chunk-W5XFREQC.js +3 -0
- package/dist/bin/shell/chunks/chunk-X2MOXVGO.js +26 -0
- package/dist/bin/shell/chunks/chunk-XOGQUO62.js +2 -0
- package/dist/bin/shell/chunks/chunk-Y57BDPQ5.js +6 -0
- package/dist/bin/shell/chunks/chunk-YE6KXFFU.js +2 -0
- package/dist/bin/shell/chunks/chunk-YEPWKN4F.js +3 -0
- package/dist/bin/shell/chunks/chunk-ZEDWVSUZ.js +19 -0
- package/dist/bin/shell/chunks/chunk-ZI4TTZL5.js +21 -0
- package/dist/bin/shell/chunks/chunk-ZZVIGHYS.js +7 -0
- package/dist/bin/shell/chunks/clear-27OP2FQZ.js +2 -0
- package/dist/bin/shell/chunks/column-FJNKONCJ.js +2 -0
- package/dist/bin/shell/chunks/comm-5FNEJE7X.js +2 -0
- package/dist/bin/shell/chunks/cp-LVKHKFHQ.js +2 -0
- package/dist/bin/shell/chunks/curl-S4FJSZA5.js +26 -0
- package/dist/bin/shell/chunks/cut-UXU6PNTT.js +2 -0
- package/dist/bin/shell/chunks/date-GGPTXVUT.js +2 -0
- package/dist/bin/shell/chunks/diff-3V3FOITV.js +2 -0
- package/dist/bin/shell/chunks/dirname-455JDV2M.js +2 -0
- package/dist/bin/shell/chunks/du-WUEAQO2W.js +2 -0
- package/dist/bin/shell/chunks/echo-HBXOI5TQ.js +2 -0
- package/dist/bin/shell/chunks/env-MXFHTVHS.js +2 -0
- package/dist/bin/shell/chunks/expand-F4FM4ML2.js +2 -0
- package/dist/bin/shell/chunks/expansion-7AYBVOIQ.js +2 -0
- package/dist/bin/shell/chunks/expr-5ZKR5ER5.js +2 -0
- package/dist/bin/shell/chunks/file-BFN7BKUR.js +2 -0
- package/dist/bin/shell/chunks/find-W4BCEJEC.js +2 -0
- package/dist/bin/shell/chunks/flag-coverage-DBKGNLJO.js +2 -0
- package/dist/bin/shell/chunks/fold-AE57YLOS.js +2 -0
- package/dist/bin/shell/chunks/grep-I63BWUKL.js +2 -0
- package/dist/bin/shell/chunks/gzip-X5IDXWZE.js +2 -0
- package/dist/bin/shell/chunks/head-TBQETLQX.js +2 -0
- package/dist/bin/shell/chunks/help-HGMKZ2GW.js +2 -0
- package/dist/bin/shell/chunks/history-2DYRIL3U.js +2 -0
- package/dist/bin/shell/chunks/hostname-RWEPTCXH.js +2 -0
- package/dist/bin/shell/chunks/html-to-markdown-2VQWCEKU.js +2 -0
- package/dist/bin/shell/chunks/join-TRRWQBEU.js +2 -0
- package/dist/bin/shell/chunks/jq-NFKKH27D.js +2 -0
- package/dist/bin/shell/chunks/ln-BSEVUP2J.js +2 -0
- package/dist/bin/shell/chunks/ls-IJLTWVOI.js +2 -0
- package/dist/bin/shell/chunks/md5sum-ZIQHOC4K.js +2 -0
- package/dist/bin/shell/chunks/mkdir-KYFAO2SF.js +2 -0
- package/dist/bin/shell/chunks/mv-TWM2PA7Q.js +2 -0
- package/dist/bin/shell/chunks/nl-XLF2HFST.js +2 -0
- package/dist/bin/shell/chunks/od-BOM6JPTH.js +2 -0
- package/dist/bin/shell/chunks/paste-FUGXVGJX.js +2 -0
- package/dist/bin/shell/chunks/printf-XUGNJ3QM.js +2 -0
- package/dist/bin/shell/chunks/pwd-RZG6GZEU.js +2 -0
- package/dist/bin/shell/chunks/python3-PIXJS3YM.js +14 -0
- package/dist/bin/shell/chunks/readlink-4SOSIDHE.js +2 -0
- package/dist/bin/shell/chunks/rev-5E5UGSUZ.js +2 -0
- package/dist/bin/shell/chunks/rg-4YJSQZN7.js +2 -0
- package/dist/bin/shell/chunks/rm-3PFOF4E3.js +2 -0
- package/dist/bin/shell/chunks/rmdir-CSK7CGH5.js +2 -0
- package/dist/bin/shell/chunks/sed-XBCUZMEP.js +2 -0
- package/dist/bin/shell/chunks/seq-H7ID4VMK.js +2 -0
- package/dist/bin/shell/chunks/sha1sum-EDQNYXXH.js +2 -0
- package/dist/bin/shell/chunks/sha256sum-APTG6DO2.js +2 -0
- package/dist/bin/shell/chunks/sleep-PNT7KILS.js +2 -0
- package/dist/bin/shell/chunks/sort-ELAGZUES.js +2 -0
- package/dist/bin/shell/chunks/split-QGXYUWBC.js +2 -0
- package/dist/bin/shell/chunks/sqlite3-ELLMKNNJ.js +2 -0
- package/dist/bin/shell/chunks/stat-Q2TZRKO3.js +2 -0
- package/dist/bin/shell/chunks/strings-IGEGP5QX.js +2 -0
- package/dist/bin/shell/chunks/tac-VOEDJLLG.js +2 -0
- package/dist/bin/shell/chunks/tail-JOQASWMV.js +2 -0
- package/dist/bin/shell/chunks/tar-2UVSVD3P.js +2 -0
- package/dist/bin/shell/chunks/tee-IQLEDZOQ.js +2 -0
- package/dist/bin/shell/chunks/time-VRCJK2LI.js +2 -0
- package/dist/bin/shell/chunks/timeout-A36YWZWR.js +2 -0
- package/dist/bin/shell/chunks/touch-5ECNQNBP.js +2 -0
- package/dist/bin/shell/chunks/tr-AVALLN54.js +2 -0
- package/dist/bin/shell/chunks/tree-UFM5EDXS.js +2 -0
- package/dist/bin/shell/chunks/true-BU5JSAAW.js +2 -0
- package/dist/bin/shell/chunks/unexpand-TDRWZW5F.js +2 -0
- package/dist/bin/shell/chunks/uniq-IKBUNAMN.js +2 -0
- package/dist/bin/shell/chunks/wc-2R4RS2SX.js +2 -0
- package/dist/bin/shell/chunks/which-6UVGMXDF.js +2 -0
- package/dist/bin/shell/chunks/whoami-N6TLTETT.js +2 -0
- package/dist/bin/shell/chunks/xan-JX5QUK32.js +2 -0
- package/dist/bin/shell/chunks/xan-view-NFMUMJ7Z.js +2 -0
- package/dist/bin/shell/chunks/xargs-4MYN4U3C.js +2 -0
- package/dist/bin/shell/chunks/yq-EHDQVD7S.js +2 -0
- package/dist/bin/shell/shell.js +711 -0
- package/dist/browser.d.ts +22 -0
- package/dist/bundle/browser.js +1481 -0
- package/dist/bundle/chunks/alias-T2KDAHDL.js +1 -0
- package/dist/bundle/chunks/awk2-UIH6CPHX.js +1 -0
- package/dist/bundle/chunks/base64-RY5JPAQL.js +1 -0
- package/dist/bundle/chunks/basename-QT55QR7O.js +1 -0
- package/dist/bundle/chunks/bash-BZZ6TUGW.js +1 -0
- package/dist/bundle/chunks/bytes-W6ESHQ7F.js +1 -0
- package/dist/bundle/chunks/cat-WUR2OJUG.js +1 -0
- package/dist/bundle/chunks/chmod-LTQYKUUW.js +1 -0
- package/dist/bundle/chunks/chunk-24BT6QUB.js +11 -0
- package/dist/bundle/chunks/chunk-274QVGRQ.js +2 -0
- package/dist/bundle/chunks/chunk-2IKXAFP4.js +11 -0
- package/dist/bundle/chunks/chunk-2IO54DPD.js +1 -0
- package/dist/bundle/chunks/chunk-2VAJD54D.js +13 -0
- package/dist/bundle/chunks/chunk-34P4G5H7.js +5 -0
- package/dist/bundle/chunks/chunk-3OY3UJDR.js +62 -0
- package/dist/bundle/chunks/chunk-3R6EWKMD.js +13 -0
- package/dist/bundle/chunks/chunk-3SPSXVPQ.js +2 -0
- package/dist/bundle/chunks/chunk-43RXAZRC.js +7 -0
- package/dist/bundle/chunks/chunk-44UOCSGV.js +1 -0
- package/dist/bundle/chunks/chunk-47LWQIG6.js +15 -0
- package/dist/bundle/chunks/chunk-4L3Y4LKT.js +5 -0
- package/dist/bundle/chunks/chunk-4LYDOEQ6.js +4 -0
- package/dist/bundle/chunks/chunk-4Q5DFBVQ.js +6 -0
- package/dist/bundle/chunks/chunk-4R5AUIZ4.js +6 -0
- package/dist/bundle/chunks/chunk-4UTZCT3W.js +2 -0
- package/dist/bundle/chunks/chunk-5FDLF2FN.js +5 -0
- package/dist/bundle/chunks/chunk-5HJSZMTG.js +1 -0
- package/dist/bundle/chunks/chunk-5NR6JZM4.js +12 -0
- package/dist/bundle/chunks/chunk-5PL72KVW.js +7 -0
- package/dist/bundle/chunks/chunk-6BM2WKUH.js +23 -0
- package/dist/bundle/chunks/chunk-6HLDZZOT.js +4 -0
- package/dist/bundle/chunks/chunk-7MKBHGLS.js +1 -0
- package/dist/bundle/chunks/chunk-7VHVF5PX.js +20 -0
- package/dist/bundle/chunks/chunk-A3YV3X3J.js +6 -0
- package/dist/bundle/chunks/chunk-AJNR4FJT.js +8 -0
- package/dist/bundle/chunks/chunk-AMQM5ZPF.js +1 -0
- package/dist/bundle/chunks/chunk-BCDE2QUY.js +1 -0
- package/dist/bundle/chunks/chunk-BMKJMOWP.js +2 -0
- package/dist/bundle/chunks/chunk-BVFIC7R6.js +4 -0
- package/dist/bundle/chunks/chunk-CC4HUWHZ.js +4 -0
- package/dist/bundle/chunks/chunk-CNCKROJZ.js +10 -0
- package/dist/bundle/chunks/chunk-CSFZQCAK.js +139 -0
- package/dist/bundle/chunks/chunk-CU7G2LMR.js +1 -0
- package/dist/bundle/chunks/chunk-CZP7PMAG.js +4 -0
- package/dist/bundle/chunks/chunk-D2OUCFAU.js +8 -0
- package/dist/bundle/chunks/chunk-DQXLKPVQ.js +7 -0
- package/dist/bundle/chunks/chunk-E6IR6BWV.js +286 -0
- package/dist/bundle/chunks/chunk-ELZ2RVIZ.js +11 -0
- package/dist/bundle/chunks/chunk-EVNUXIEZ.js +2 -0
- package/dist/bundle/chunks/chunk-F6FQRFZU.js +6 -0
- package/dist/bundle/chunks/chunk-FAECBHMR.js +2 -0
- package/dist/bundle/chunks/chunk-FBOLGXN4.js +16 -0
- package/dist/bundle/chunks/chunk-FNIOXBJW.js +9 -0
- package/dist/bundle/chunks/chunk-GD5SDRL7.js +5 -0
- package/dist/bundle/chunks/chunk-GEAGCSIY.js +31 -0
- package/dist/bundle/chunks/chunk-GI2KN5IL.js +22 -0
- package/dist/bundle/chunks/chunk-GOG2LNAH.js +9 -0
- package/dist/bundle/chunks/chunk-H2ENJVUI.js +10 -0
- package/dist/bundle/chunks/chunk-HDNR2KMO.js +13 -0
- package/dist/bundle/chunks/chunk-HJ37IXKX.js +12 -0
- package/dist/bundle/chunks/chunk-I36BZMR3.js +1 -0
- package/dist/bundle/chunks/chunk-I6YSZMB6.js +15 -0
- package/dist/bundle/chunks/chunk-IJXFPKNC.js +1 -0
- package/dist/bundle/chunks/chunk-IXD4Z54Z.js +8 -0
- package/dist/bundle/chunks/chunk-J44PYBAW.js +2 -0
- package/dist/bundle/chunks/chunk-JDREUEBG.js +9 -0
- package/dist/bundle/chunks/chunk-KA244HSE.js +5 -0
- package/dist/bundle/chunks/chunk-KKZJ6K7R.js +8 -0
- package/dist/bundle/chunks/chunk-KZ3P3SVS.js +22 -0
- package/dist/bundle/chunks/chunk-LIVSDOY2.js +1 -0
- package/dist/bundle/chunks/chunk-LX7SQKLW.js +15 -0
- package/dist/bundle/chunks/chunk-M5O5DYR7.js +1 -0
- package/dist/bundle/chunks/chunk-MML7K3J2.js +6 -0
- package/dist/bundle/chunks/chunk-N4GRDEVJ.js +5 -0
- package/dist/bundle/chunks/chunk-NPZMNEW5.js +6 -0
- package/dist/bundle/chunks/chunk-NUFRM6SI.js +0 -0
- package/dist/bundle/chunks/chunk-O7N2RCS7.js +1 -0
- package/dist/bundle/chunks/chunk-OSYLT4VG.js +4 -0
- package/dist/bundle/chunks/chunk-OXRHP7HO.js +3 -0
- package/dist/bundle/chunks/chunk-OZOS3R6K.js +99 -0
- package/dist/bundle/chunks/chunk-OZQ4AW5X.js +8 -0
- package/dist/bundle/chunks/chunk-PNGAWBIZ.js +10 -0
- package/dist/bundle/chunks/chunk-PPUKM2B7.js +13 -0
- package/dist/bundle/chunks/chunk-PTELGM2J.js +7 -0
- package/dist/bundle/chunks/chunk-Q3TLRYBC.js +72 -0
- package/dist/bundle/chunks/chunk-Q5AOYNOX.js +6 -0
- package/dist/bundle/chunks/chunk-QEKGAAIL.js +1 -0
- package/dist/bundle/chunks/chunk-QIL3FXIC.js +6 -0
- package/dist/bundle/chunks/chunk-QNZEO23C.js +8 -0
- package/dist/bundle/chunks/chunk-R4IVADTA.js +7 -0
- package/dist/bundle/chunks/chunk-RK57WTFF.js +12 -0
- package/dist/bundle/chunks/chunk-RU5M6ZRS.js +4 -0
- package/dist/bundle/chunks/chunk-SBVBPPEQ.js +5 -0
- package/dist/bundle/chunks/chunk-SP22LBKJ.js +20 -0
- package/dist/bundle/chunks/chunk-UKS3AEEA.js +32 -0
- package/dist/bundle/chunks/chunk-UYR5HJI6.js +7 -0
- package/dist/bundle/chunks/chunk-V6ANTLBA.js +15 -0
- package/dist/bundle/chunks/chunk-VLGZJRPG.js +16 -0
- package/dist/bundle/chunks/chunk-VZUQMDOT.js +2 -0
- package/dist/bundle/chunks/chunk-XDQU6V6S.js +19 -0
- package/dist/bundle/chunks/chunk-XRVUJRYI.js +35 -0
- package/dist/bundle/chunks/chunk-YNYSPYQ5.js +32 -0
- package/dist/bundle/chunks/clear-NLKZY76S.js +1 -0
- package/dist/bundle/chunks/column-S7P64XRJ.js +1 -0
- package/dist/bundle/chunks/comm-FPLN4BYY.js +1 -0
- package/dist/bundle/chunks/cp-W5HXJH5J.js +1 -0
- package/dist/bundle/chunks/curl-UFR6W4B6.js +25 -0
- package/dist/bundle/chunks/cut-VNFQFCA7.js +1 -0
- package/dist/bundle/chunks/date-EDSSFONA.js +1 -0
- package/dist/bundle/chunks/diff-RR5VJXIT.js +1 -0
- package/dist/bundle/chunks/dirname-V7Z24BGZ.js +1 -0
- package/dist/bundle/chunks/du-QKRPQIMY.js +1 -0
- package/dist/bundle/chunks/echo-TR3BM2AJ.js +1 -0
- package/dist/bundle/chunks/env-SVQBHVZF.js +1 -0
- package/dist/bundle/chunks/expand-ZVCJ72RF.js +1 -0
- package/dist/bundle/chunks/expansion-OBOJBZTH.js +1 -0
- package/dist/bundle/chunks/expr-QRA5KFYV.js +1 -0
- package/dist/bundle/chunks/file-TORG4IVZ.js +1 -0
- package/dist/bundle/chunks/find-NAGPRRQ7.js +1 -0
- package/dist/bundle/chunks/flag-coverage-FMTW4YWD.js +1 -0
- package/dist/bundle/chunks/fold-L4U6GS2N.js +1 -0
- package/dist/bundle/chunks/grep-D6AI423Z.js +1 -0
- package/dist/bundle/chunks/gzip-4EFUBHN7.js +1 -0
- package/dist/bundle/chunks/head-KBQT2JAC.js +1 -0
- package/dist/bundle/chunks/help-F3TJS3LS.js +1 -0
- package/dist/bundle/chunks/history-OKEAINJD.js +1 -0
- package/dist/bundle/chunks/hostname-AGIPNJOC.js +1 -0
- package/dist/bundle/chunks/html-to-markdown-P2LSCPVF.js +1 -0
- package/dist/bundle/chunks/join-FTSZAZYU.js +1 -0
- package/dist/bundle/chunks/jq-TNIKCGGT.js +1 -0
- package/dist/bundle/chunks/ln-BWYUCELO.js +1 -0
- package/dist/bundle/chunks/ls-6BM6G675.js +1 -0
- package/dist/bundle/chunks/md5sum-ALFVDB3W.js +1 -0
- package/dist/bundle/chunks/mkdir-I3BZBLTZ.js +1 -0
- package/dist/bundle/chunks/mv-76WRD5SE.js +1 -0
- package/dist/bundle/chunks/nl-77Q7V2GV.js +1 -0
- package/dist/bundle/chunks/od-AA6TIC6A.js +1 -0
- package/dist/bundle/chunks/paste-C6JKQOHO.js +1 -0
- package/dist/bundle/chunks/printf-WOYMDX2I.js +1 -0
- package/dist/bundle/chunks/pwd-BE3B3ZPG.js +1 -0
- package/dist/bundle/chunks/python3-QFUFNW7I.js +13 -0
- package/dist/bundle/chunks/readlink-QI6K7ZZX.js +1 -0
- package/dist/bundle/chunks/rev-2FZQEIQG.js +1 -0
- package/dist/bundle/chunks/rg-CNS6SD3V.js +1 -0
- package/dist/bundle/chunks/rm-JMWEKCU4.js +1 -0
- package/dist/bundle/chunks/rmdir-5HDB4IQ7.js +1 -0
- package/dist/bundle/chunks/sed-CSUGXVBJ.js +1 -0
- package/dist/bundle/chunks/seq-UP62NDEL.js +1 -0
- package/dist/bundle/chunks/sha1sum-XXYTWQIW.js +1 -0
- package/dist/bundle/chunks/sha256sum-GD6AFWG3.js +1 -0
- package/dist/bundle/chunks/sleep-225KIGXI.js +1 -0
- package/dist/bundle/chunks/sort-BIWEEIVX.js +1 -0
- package/dist/bundle/chunks/split-QUFGLTTX.js +1 -0
- package/dist/bundle/chunks/sqlite3-3ZFEGTQ7.js +1 -0
- package/dist/bundle/chunks/stat-DIMPSC6S.js +1 -0
- package/dist/bundle/chunks/strings-LECMRXOT.js +1 -0
- package/dist/bundle/chunks/tac-A6JKZKWL.js +1 -0
- package/dist/bundle/chunks/tail-YGDXZZGG.js +1 -0
- package/dist/bundle/chunks/tar-7KN7KZ6S.js +1 -0
- package/dist/bundle/chunks/tee-J4MBDQJZ.js +1 -0
- package/dist/bundle/chunks/time-CVS7ESWV.js +1 -0
- package/dist/bundle/chunks/timeout-UX2PSLYJ.js +1 -0
- package/dist/bundle/chunks/touch-ATQADRUQ.js +1 -0
- package/dist/bundle/chunks/tr-QVFN4YWH.js +1 -0
- package/dist/bundle/chunks/tree-IY7WNFVF.js +1 -0
- package/dist/bundle/chunks/true-AKKYE7WM.js +1 -0
- package/dist/bundle/chunks/unexpand-2WTX7UPB.js +1 -0
- package/dist/bundle/chunks/uniq-XS6VGRO2.js +1 -0
- package/dist/bundle/chunks/wc-22EISCPD.js +1 -0
- package/dist/bundle/chunks/which-IWHCX6SW.js +1 -0
- package/dist/bundle/chunks/whoami-HCON4D7C.js +1 -0
- package/dist/bundle/chunks/worker.js +2260 -0
- package/dist/bundle/chunks/xan-XDECJHII.js +1 -0
- package/dist/bundle/chunks/xan-view-IJ4EABH7.js +1 -0
- package/dist/bundle/chunks/xargs-5MMN7C6P.js +1 -0
- package/dist/bundle/chunks/yq-LQX5YIGM.js +1 -0
- package/dist/bundle/index.js +688 -0
- package/dist/commands/alias/alias.d.ts +6 -0
- package/dist/commands/awk/ast.d.ts +202 -0
- package/dist/commands/awk/awk2.d.ts +9 -0
- package/dist/commands/awk/builtins.d.ts +17 -0
- package/dist/commands/awk/interpreter/context.d.ts +73 -0
- package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
- package/dist/commands/awk/interpreter/fields.d.ts +25 -0
- package/dist/commands/awk/interpreter/index.d.ts +8 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +52 -0
- package/dist/commands/awk/interpreter/statements.d.ts +11 -0
- package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
- package/dist/commands/awk/interpreter/types.d.ts +13 -0
- package/dist/commands/awk/interpreter/variables.d.ts +35 -0
- package/dist/commands/awk/lexer.d.ts +100 -0
- package/dist/commands/awk/parser2-print.d.ts +35 -0
- package/dist/commands/awk/parser2.d.ts +81 -0
- package/dist/commands/base64/base64.d.ts +7 -0
- package/dist/commands/basename/basename.d.ts +4 -0
- package/dist/commands/bash/bash.d.ts +6 -0
- package/dist/commands/browser-excluded.d.ts +16 -0
- package/dist/commands/cat/cat.d.ts +4 -0
- package/dist/commands/chmod/chmod.d.ts +4 -0
- package/dist/commands/clear/clear.d.ts +4 -0
- package/dist/commands/column/column.d.ts +11 -0
- package/dist/commands/comm/comm.d.ts +12 -0
- package/dist/commands/cp/cp.d.ts +4 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +21 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/response-formatting.d.ts +20 -0
- package/dist/commands/curl/types.d.ts +31 -0
- package/dist/commands/cut/cut.d.ts +4 -0
- package/dist/commands/date/date.d.ts +7 -0
- package/dist/commands/diff/diff.d.ts +7 -0
- package/dist/commands/dirname/dirname.d.ts +4 -0
- package/dist/commands/du/du.d.ts +4 -0
- package/dist/commands/echo/echo.d.ts +4 -0
- package/dist/commands/env/env.d.ts +6 -0
- package/dist/commands/expand/expand.d.ts +12 -0
- package/dist/commands/expand/unexpand.d.ts +12 -0
- package/dist/commands/expr/expr.d.ts +9 -0
- package/dist/commands/file/file.d.ts +9 -0
- package/dist/commands/find/find.d.ts +4 -0
- package/dist/commands/find/matcher.d.ts +69 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +88 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +12 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +8 -0
- package/dist/commands/gzip/gzip.d.ts +13 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +4 -0
- package/dist/commands/help/help.d.ts +4 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +4 -0
- package/dist/commands/hostname/hostname.d.ts +11 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
- package/dist/commands/join/join.d.ts +12 -0
- package/dist/commands/jq/jq.d.ts +9 -0
- package/dist/commands/ln/ln.d.ts +4 -0
- package/dist/commands/ls/ls.d.ts +4 -0
- package/dist/commands/md5sum/checksum.d.ts +7 -0
- package/dist/commands/md5sum/md5sum.d.ts +4 -0
- package/dist/commands/md5sum/sha1sum.d.ts +4 -0
- package/dist/commands/md5sum/sha256sum.d.ts +4 -0
- package/dist/commands/mkdir/mkdir.d.ts +4 -0
- package/dist/commands/mv/mv.d.ts +4 -0
- package/dist/commands/nl/nl.d.ts +12 -0
- package/dist/commands/od/od.d.ts +12 -0
- package/dist/commands/paste/paste.d.ts +4 -0
- package/dist/commands/printf/escapes.d.ts +31 -0
- package/dist/commands/printf/printf.d.ts +4 -0
- package/dist/commands/printf/strftime.d.ts +9 -0
- package/dist/commands/pwd/pwd.d.ts +4 -0
- package/dist/commands/python3/fs-bridge-handler.d.ts +50 -0
- package/dist/commands/python3/protocol.d.ts +138 -0
- package/dist/commands/python3/python3.d.ts +11 -0
- package/dist/commands/python3/sync-fs-backend.d.ts +59 -0
- package/dist/commands/python3/worker.d.ts +22 -0
- package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
- package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/index.d.ts +17 -0
- package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
- package/dist/commands/query-engine/evaluator.d.ts +37 -0
- package/dist/commands/query-engine/index.d.ts +8 -0
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +9 -0
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/safe-object.d.ts +59 -0
- package/dist/commands/query-engine/value-operations.d.ts +41 -0
- package/dist/commands/readlink/readlink.d.ts +4 -0
- package/dist/commands/registry.d.ts +45 -0
- package/dist/commands/rev/rev.d.ts +13 -0
- package/dist/commands/rg/file-types.d.ts +49 -0
- package/dist/commands/rg/gitignore.d.ts +98 -0
- package/dist/commands/rg/rg-options.d.ts +61 -0
- package/dist/commands/rg/rg-parser.d.ts +20 -0
- package/dist/commands/rg/rg-search.d.ts +15 -0
- package/dist/commands/rg/rg.d.ts +14 -0
- package/dist/commands/rm/rm.d.ts +4 -0
- package/dist/commands/rmdir/rmdir.d.ts +4 -0
- package/dist/commands/search-engine/index.d.ts +10 -0
- package/dist/commands/search-engine/matcher.d.ts +60 -0
- package/dist/commands/search-engine/regex.d.ts +33 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/lexer.d.ts +86 -0
- package/dist/commands/sed/parser.d.ts +18 -0
- package/dist/commands/sed/sed-regex.d.ts +23 -0
- package/dist/commands/sed/sed.d.ts +4 -0
- package/dist/commands/sed/types.d.ts +219 -0
- package/dist/commands/seq/seq.d.ts +16 -0
- package/dist/commands/sleep/sleep.d.ts +4 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +4 -0
- package/dist/commands/sort/types.d.ts +30 -0
- package/dist/commands/split/split.d.ts +12 -0
- package/dist/commands/sqlite3/formatters.d.ts +15 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +16 -0
- package/dist/commands/sqlite3/worker.d.ts +44 -0
- package/dist/commands/stat/stat.d.ts +4 -0
- package/dist/commands/strings/strings.d.ts +12 -0
- package/dist/commands/tac/tac.d.ts +11 -0
- package/dist/commands/tail/tail.d.ts +4 -0
- package/dist/commands/tar/archive.d.ts +107 -0
- package/dist/commands/tar/tar-options.d.ts +36 -0
- package/dist/commands/tar/tar.d.ts +10 -0
- package/dist/commands/tee/tee.d.ts +4 -0
- package/dist/commands/time/time.d.ts +27 -0
- package/dist/commands/timeout/timeout.d.ts +4 -0
- package/dist/commands/touch/touch.d.ts +4 -0
- package/dist/commands/tr/tr.d.ts +4 -0
- package/dist/commands/tree/tree.d.ts +4 -0
- package/dist/commands/true/true.d.ts +6 -0
- package/dist/commands/uniq/uniq.d.ts +4 -0
- package/dist/commands/wc/wc.d.ts +4 -0
- package/dist/commands/which/which.d.ts +4 -0
- package/dist/commands/whoami/whoami.d.ts +11 -0
- package/dist/commands/xan/aggregation.d.ts +20 -0
- package/dist/commands/xan/column-selection.d.ts +19 -0
- package/dist/commands/xan/csv.d.ts +37 -0
- package/dist/commands/xan/moonblade-parser.d.ts +80 -0
- package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
- package/dist/commands/xan/subcommands.d.ts +15 -0
- package/dist/commands/xan/xan-agg.d.ts +8 -0
- package/dist/commands/xan/xan-columns.d.ts +8 -0
- package/dist/commands/xan/xan-core.d.ts +10 -0
- package/dist/commands/xan/xan-data.d.ts +52 -0
- package/dist/commands/xan/xan-filter.d.ts +8 -0
- package/dist/commands/xan/xan-map.d.ts +11 -0
- package/dist/commands/xan/xan-reshape.d.ts +40 -0
- package/dist/commands/xan/xan-simple.d.ts +40 -0
- package/dist/commands/xan/xan-view.d.ts +12 -0
- package/dist/commands/xan/xan.d.ts +10 -0
- package/dist/commands/xargs/xargs.d.ts +4 -0
- package/dist/commands/yq/formats.d.ts +64 -0
- package/dist/commands/yq/yq.d.ts +13 -0
- package/dist/custom-commands.d.ts +61 -0
- package/dist/fs/encoding.d.ts +17 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +63 -0
- package/dist/fs/in-memory-fs/index.d.ts +1 -0
- package/dist/fs/init.d.ts +12 -0
- package/dist/fs/interface.d.ts +219 -0
- package/dist/fs/mountable-fs/index.d.ts +1 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +120 -0
- package/dist/fs/overlay-fs/index.d.ts +1 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +126 -0
- package/dist/fs/read-write-fs/index.d.ts +1 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +69 -0
- package/dist/index.d.ts +19 -0
- package/dist/interpreter/alias-expansion.d.ts +23 -0
- package/dist/interpreter/arithmetic.d.ts +24 -0
- package/dist/interpreter/assignment-expansion.d.ts +24 -0
- package/dist/interpreter/builtin-dispatch.d.ts +39 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/compgen.d.ts +26 -0
- package/dist/interpreter/builtins/complete.d.ts +17 -0
- package/dist/interpreter/builtins/compopt.d.ts +28 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
- package/dist/interpreter/builtins/declare-print.d.ts +39 -0
- package/dist/interpreter/builtins/declare.d.ts +35 -0
- package/dist/interpreter/builtins/dirs.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +9 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +14 -0
- package/dist/interpreter/builtins/getopts.d.ts +18 -0
- package/dist/interpreter/builtins/hash.d.ts +19 -0
- package/dist/interpreter/builtins/help.d.ts +12 -0
- package/dist/interpreter/builtins/index.d.ts +45 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/mapfile.d.ts +17 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +9 -0
- package/dist/interpreter/builtins/shift.d.ts +15 -0
- package/dist/interpreter/builtins/shopt.d.ts +7 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +16 -0
- package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
- package/dist/interpreter/command-resolution.d.ts +43 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/errors.d.ts +150 -0
- package/dist/interpreter/expansion/analysis.d.ts +37 -0
- package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
- package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
- package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
- package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +20 -0
- package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
- package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
- package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
- package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
- package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
- package/dist/interpreter/expansion/pattern.d.ts +23 -0
- package/dist/interpreter/expansion/positional-params.d.ts +59 -0
- package/dist/interpreter/expansion/prompt.d.ts +39 -0
- package/dist/interpreter/expansion/quoting.d.ts +13 -0
- package/dist/interpreter/expansion/tilde.d.ts +12 -0
- package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
- package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
- package/dist/interpreter/expansion/variable.d.ts +43 -0
- package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
- package/dist/interpreter/expansion/word-split.d.ts +29 -0
- package/dist/interpreter/expansion.d.ts +57 -0
- package/dist/interpreter/functions.d.ts +12 -0
- package/dist/interpreter/helpers/array.d.ts +43 -0
- package/dist/interpreter/helpers/condition.d.ts +18 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +104 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/nameref.d.ts +65 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/quoting.d.ts +24 -0
- package/dist/interpreter/helpers/readonly.d.ts +45 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +62 -0
- package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/statements.d.ts +20 -0
- package/dist/interpreter/helpers/string-compare.d.ts +24 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/tilde.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-matching.d.ts +26 -0
- package/dist/interpreter/helpers/word-parts.d.ts +29 -0
- package/dist/interpreter/helpers/xtrace.d.ts +18 -0
- package/dist/interpreter/index.d.ts +3 -0
- package/dist/interpreter/interpreter.d.ts +65 -0
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/redirections.d.ts +51 -0
- package/dist/interpreter/simple-command-assignments.d.ts +29 -0
- package/dist/interpreter/subshell-group.d.ts +32 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +317 -0
- package/dist/limits.d.ts +42 -0
- package/dist/network/allow-list/shared.d.ts +45 -0
- package/dist/network/allow-list.d.ts +51 -0
- package/dist/network/fetch.d.ts +25 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +96 -0
- package/dist/parser/arithmetic-parser.d.ts +23 -0
- package/dist/parser/arithmetic-primaries.d.ts +45 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +28 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +16 -0
- package/dist/parser/lexer.d.ts +192 -0
- package/dist/parser/parser-substitution.d.ts +62 -0
- package/dist/parser/parser.d.ts +135 -0
- package/dist/parser/types.d.ts +25 -0
- package/dist/parser/word-parser.d.ts +33 -0
- package/dist/sandbox/Command.d.ts +28 -0
- package/dist/sandbox/Sandbox.d.ts +60 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/shell-metadata.d.ts +28 -0
- package/dist/test-utils.d.ts +15 -0
- package/dist/types.d.ts +148 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/bytes.d.ts +39 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/file-reader.d.ts +67 -0
- package/dist/utils/glob.d.ts +25 -0
- package/package.json +115 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as U,b as q,c as H}from"./chunk-G43H2WGH.js";import{a as T}from"./chunk-SE4C7FJY.js";import{a as E,b as G,c as O}from"./chunk-227L3ACM.js";import{g,h as v,i as R,l as B}from"./chunk-RQSPCXDR.js";var V={js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}},k=class{types;constructor(){this.types=new Map(Object.entries(V).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let a=this.types.get(s)||{extensions:[],globs:[]};a.extensions.push(...i.extensions),a.globs.push(...i.globs),this.types.set(s,a)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let a=i.replace(/\./g,"\\.").replace(/\*/g,".*");if(T(`^${a}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if(T(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function Y(){let e=[];for(let[t,n]of Object.entries(V).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`}function Z(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:1/0,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function ne(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function re(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:g,stderr:v(`rg: invalid --max-filesize value: ${e}
|
|
5
|
+
`),exitCode:1}}function J(e){return null}var K=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:J},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:J},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:ne,validate:re},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",target:"maxDepth",parse:()=>1/0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],ie=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),le=new Set(["n","--line-number"]);function oe(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function ae(e,t,n){let s=e[t];for(let r of K){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=A(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=A(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=A(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function ce(e){return K.find(t=>t.short===e)}function A(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function fe(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(n.startsWith("--sort=")){let s=n.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function ue(e,t){let n=e[t],s=n.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function he(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function X(e){let t=Z(),n=null,s=[],r=-1,l=-1,i=-1,a=!1;for(let c=0;c<e.length;c++){let o=e[c];if(o.startsWith("-")&&o!=="-"){let u=ue(e,c);if(u){let{flag:f,value:y,newIndex:w}=u;f==="A"?r=Math.max(r,y):f==="B"?l=Math.max(l,y):i=y,c=w;continue}let x=he(o);if(x!==null){t.maxCount=x;continue}let m=ae(e,c,t);if(m){if(m.error)return{success:!1,error:m.error};c=m.newIndex;continue}let p=fe(e,c);if(p){t.sort=p.value,c=p.newIndex;continue}let C=o.startsWith("--")?[o]:o.slice(1).split(""),d=!1;for(let f of C){if(le.has(f)){t.lineNumber=!0,a=!0;continue}if(f==="u"||f==="--unrestricted"){oe(t);continue}if(f==="P"||f==="--pcre2")return{success:!1,error:{stdout:g,stderr:v(`rg: PCRE2 is not supported. Use standard regex syntax instead.
|
|
6
|
+
`),exitCode:1}};if(f.length===1){let w=ce(f);if(w){if(c+1>=e.length)return{success:!1,error:O("rg",`-${f}`)};let h=A(t,w,e[c+1]);if(h)return{success:!1,error:h};c++,d=!0;continue}}let y=ie.get(f);if(y){y(t);continue}if(f.startsWith("--"))return{success:!1,error:O("rg",f)};if(f.length===1)return{success:!1,error:O("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=o:s.push(o)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(a=!0),{success:!0,options:t,paths:s,explicitLineNumbers:a}}import{gunzipSync as ge}from"node:zlib";var N=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
|
|
7
|
+
`);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let a=!1;r.startsWith("/")?(a=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(a=!0);let c=this.patternToRegex(r,a);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:a})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let a=t.slice(r,i+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),s+=a,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",T(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},W=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let a=this.fs.resolvePath(l,i);try{let c=await this.fs.readFile(a),o=new N(l);o.parse(c),this.parsers.push(o)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFile(r),i=new N(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new N(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function _(e,t,n=!1,s=!1,r=[]){let l=new W(e,t,n,s);await l.load(t);for(let i of r)try{let a=e.resolvePath(t,i),c=await e.readFile(a);l.addPatternsFromContent(c,t)}catch{}return l}function pe(e){return e.length>=2&&e[0]===31&&e[1]===139}function me(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s==="["&&!t?t=!0:s==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function Q(e){let{ctx:t,options:n,paths:s,explicitLineNumbers:r}=e;for(let f of n.globs){let y=f.startsWith("!")?f.slice(1):f,w=me(y);if(w)return{stdout:g,stderr:v(`${w}
|
|
8
|
+
`),exitCode:1}}if(n.files){let f=[...n.patterns,...s];return ye(t,f,n)}let l=[...n.patterns];for(let f of n.patternFiles)try{let y;if(f==="-")y=R(t.stdin);else{let h=t.fs.resolvePath(t.cwd,f);y=await t.fs.readFile(h)}let w=y.split(`
|
|
9
|
+
`).filter(h=>h.length>0);l.push(...w)}catch{return{stdout:g,stderr:v(`rg: ${f}: No such file or directory
|
|
10
|
+
`),exitCode:2}}if(l.length===0)return n.patternFiles.length>0?{stdout:g,stderr:g,exitCode:1}:{stdout:g,stderr:v(`rg: no pattern given
|
|
11
|
+
`),exitCode:2};let i=s.length===0?["."]:s,a=de(n,l),c,o;try{let f=xe(l,n,a);c=f.regex,o=f.kResetGroup}catch{return{stdout:g,stderr:v(`rg: invalid regex: ${l.join(", ")}
|
|
12
|
+
`),exitCode:2}}let u=null;n.noIgnore||(u=await _(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let x=new k;for(let f of n.typeClear)x.clearType(f);for(let f of n.typeAdd)x.addType(f);let{files:m,singleExplicitFile:p}=await ee(t,i,n,u,x);if(m.length===0)return{stdout:g,stderr:g,exitCode:1};let C=!n.noFilename&&(n.withFilename||!p||m.length>1),d=n.lineNumber;return r||(p&&m.length===1&&(d=!1),n.onlyMatching&&(d=!1)),ve(t,m,c,n,C,d,o)}function de(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function xe(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),q(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function ee(e,t,n,s,r){let l=[],i=0,a=0;for(let o of t){let u=e.fs.resolvePath(e.cwd,o);try{let x=await e.fs.stat(u);if(x.isFile){if(i++,n.maxFilesize>0&&x.size>n.maxFilesize)continue;se(o,n,s,u,r)&&l.push(o)}else x.isDirectory&&(a++,await te(e,o,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&a===0}}async function te(e,t,n,s,r,l,i,a){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(o=>({name:o,isFile:void 0}));for(let o of c){let u=o.name;if(!r.noIgnore&&W.isCommonIgnored(u))continue;let x=u.startsWith("."),m=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,p=e.fs.resolvePath(n,u),C,d,f=!1;if(o.isFile!==void 0&&"isDirectory"in o){let h=o;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let b=await e.fs.stat(p);C=b.isFile,d=b.isDirectory}catch{continue}else C=h.isFile,d=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(p):await e.fs.stat(p);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let b=f&&r.followSymlinks?await e.fs.stat(p):h;C=b.isFile,d=b.isDirectory}catch{continue}if(!l?.matches(p,d)&&!(x&&!r.hidden&&!l?.isWhitelisted(p,d))){if(d)await te(e,m,p,s+1,r,l,i,a);else if(C){if(r.maxFilesize>0)try{if((await e.fs.stat(p)).size>r.maxFilesize)continue}catch{continue}se(m,r,l,p,i)&&a.push(m)}}}}catch{}}}function se(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,a=t.globs.filter(o=>!o.startsWith("!")),c=t.globs.filter(o=>o.startsWith("!")).map(o=>o.slice(1));if(a.length>0){let o=!1;for(let u of a)if(F(l,u,i)||F(e,u,i)){o=!0;break}if(!o)return!1}for(let o of c)if(o.startsWith("/")){let u=o.slice(1);if(F(e,u,i))return!1}else if(F(l,o,i)||F(e,o,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),a=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let o of i)if(F(l,o,!0)||F(e,o,!0)){c=!0;break}if(!c)return!1}for(let c of a)if(c.startsWith("/")){let o=c.slice(1);if(F(e,o,!0))return!1}else if(F(l,c,!0)||F(e,c,!0))return!1}return!0}function F(e,t,n=!1){let s="^";for(let r=0;r<t.length;r++){let l=t[r];if(l==="*")t[r+1]==="*"?(s+=".*",r++):s+="[^/]*";else if(l==="?")s+="[^/]";else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let a=t.slice(r,i+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),s+=a,r=i}else s+="\\["}else s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return s+="$",T(s,n?"i":"").test(e)}async function ye(e,t,n){let s=null;n.noIgnore||(s=await _(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new k;for(let o of n.typeClear)r.clearType(o);for(let o of n.typeAdd)r.addType(o);let l=t.length===0?["."]:t,{files:i}=await ee(e,l,n,s,r);if(i.length===0)return{stdout:g,stderr:g,exitCode:1};if(n.quiet)return{stdout:g,stderr:g,exitCode:0};let a=n.nullSeparator?"\0":`
|
|
13
|
+
`,c=i.map(o=>o+a).join("");return{stdout:v(c),stderr:g,exitCode:0}}function be(e,t){if(t.length===0)return!0;for(let n of t)if(F(e,n,!1))return!0;return!1}async function we(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(be(i,s.preprocessorGlobs)){let a=await e.exec(`${s.preprocessor} "${t}"`,{cwd:e.cwd});if(a.exitCode===0&&a.stdout.length>0){let c=R(a.stdout),o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await e.fs.readFileBuffer(t);if(pe(i))try{let a=ge(i),c=new TextDecoder().decode(a),o=c.slice(0,8192);return{content:c,isBinary:o.includes("\0")}}catch{return null}}let r=await e.fs.readFile(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function ve(e,t,n,s,r,l,i){let a="",c=!1,o=[],u=0,x=0,m=0,p=50;e:for(let f=0;f<t.length;f+=p){let y=t.slice(f,f+p),w=await Promise.all(y.map(async h=>{let b=e.fs.resolvePath(e.cwd,h),S=await we(e,b,h,s);if(!S)return null;let{content:I,isBinary:j}=S;if(m+=I.length,j&&!s.searchBinary)return null;let D=r&&!s.heading?h:"",$=U(I,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:D,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace!==null?H(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&$.matched?{file:h,result:$,content:I,isBinary:!1}:{file:h,result:$}}));for(let h of w){if(!h)continue;let{file:b,result:S}=h;if(S.matched){if(c=!0,x++,u+=S.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let I=h.content||"";o.push(JSON.stringify({type:"begin",data:{path:{text:b}}}));let j=I.split(`
|
|
14
|
+
`);n.lastIndex=0;let D=0;for(let $=0;$<j.length;$++){let P=j[$];n.lastIndex=0;let L=[];for(let M=n.exec(P);M!==null;M=n.exec(P)){let z={match:{text:M[0]},start:M.index,end:M.index+M[0].length};s.replace!==null&&(z.replacement={text:s.replace}),L.push(z),M[0].length===0&&n.lastIndex++}if(L.length>0){let M={type:"match",data:{path:{text:b},lines:{text:`${P}
|
|
15
|
+
`},line_number:$+1,absolute_offset:D,submatches:L}};o.push(JSON.stringify(M))}D+=P.length+1}o.push(JSON.stringify({type:"end",data:{path:{text:b},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:I.length,bytes_printed:0,matched_lines:S.matchCount,matches:S.matchCount}}}))}else if(s.filesWithMatches){let I=s.nullSeparator?"\0":`
|
|
16
|
+
`;a+=`${b}${I}`}else s.filesWithoutMatch||(s.heading&&!s.noFilename&&(a+=`${b}
|
|
17
|
+
`),a+=S.output)}else if(s.filesWithoutMatch){let I=s.nullSeparator?"\0":`
|
|
18
|
+
`;a+=`${b}${I}`}else s.includeZero&&(s.count||s.countMatches)&&(a+=S.output)}}s.json&&(o.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:x,bytes_searched:m,bytes_printed:0,matched_lines:u,matches:u}}})),a=`${o.join(`
|
|
19
|
+
`)}
|
|
20
|
+
`);let C=s.quiet&&!s.json?"":a;if(s.stats&&!s.json){let f=["",`${u} matches`,`${u} matched lines`,`${x} files contained matches`,`${t.length} files searched`,`${m} bytes searched`].join(`
|
|
21
|
+
`);C+=`${f}
|
|
22
|
+
`}let d;return s.filesWithoutMatch?d=a.length>0?0:1:d=c?0:1,{stdout:v(C),stderr:g,exitCode:d}}var Ce={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
|
|
23
|
+
Unlike grep, rg is recursive by default and respects .gitignore files.
|
|
24
|
+
|
|
25
|
+
EXAMPLES:
|
|
26
|
+
rg foo Search for 'foo' in current directory
|
|
27
|
+
rg foo src/ Search in src/ directory
|
|
28
|
+
rg -i foo Case-insensitive search
|
|
29
|
+
rg -w foo Match whole words only
|
|
30
|
+
rg -t js foo Search only JavaScript files
|
|
31
|
+
rg -g '*.ts' foo Search files matching glob
|
|
32
|
+
rg --hidden foo Include hidden files
|
|
33
|
+
rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Ue={name:"rg",async execute(e,t){let n=B(e);if(G(n))return E(Ce);if(n.includes("--type-list"))return{stdout:v(Y()),stderr:g,exitCode:0};let s=X(n);return s.success?Q({ctx:t,options:s.options,paths:s.paths,explicitLineNumbers:s.explicitLineNumbers}):s.error}},qe={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0};export{Ue as a,qe as b};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as S}from"./chunk-KFLJ4EMB.js";import{a as h,b as y}from"./chunk-227L3ACM.js";import{g as d,h as l,l as m}from"./chunk-RQSPCXDR.js";var A={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},O={format:{short:"c",type:"string"}},C={name:"stat",async execute(e,a){let i=m(e);if(y(i))return h(A);let s=S("stat",i,O);if(!s.ok)return s.error;let p=s.result.flags.format??null,f=s.result.positional;if(f.length===0)return{stdout:d,stderr:l(`stat: missing operand
|
|
3
|
+
`),exitCode:1};let o="",g="",u=!1;for(let n of f){let F=a.fs.resolvePath(a.cwd,n);try{let r=await a.fs.stat(F);if(p){let t=p,c=r.mode.toString(8),x=$(r.mode,r.isDirectory);t=t.replace(/%n/g,n),t=t.replace(/%N/g,`'${n}'`),t=t.replace(/%s/g,String(r.size)),t=t.replace(/%F/g,r.isDirectory?"directory":"regular file"),t=t.replace(/%a/g,c),t=t.replace(/%A/g,x),t=t.replace(/%u/g,"1000"),t=t.replace(/%U/g,"user"),t=t.replace(/%g/g,"1000"),t=t.replace(/%G/g,"group"),o+=`${t}
|
|
4
|
+
`}else{let t=r.mode.toString(8).padStart(4,"0"),c=$(r.mode,r.isDirectory);o+=` File: ${n}
|
|
5
|
+
`,o+=` Size: ${r.size} Blocks: ${Math.ceil(r.size/512)}
|
|
6
|
+
`,o+=`Access: (${t}/${c})
|
|
7
|
+
`,o+=`Modify: ${r.mtime.toISOString()}
|
|
8
|
+
`}}catch{g+=`stat: cannot stat '${n}': No such file or directory
|
|
9
|
+
`,u=!0}}return{stdout:l(o),stderr:l(g),exitCode:u?1:0}}};function $(e,a){let i=a?"d":"-",s=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"];return i+s.join("")}var D={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{C as a,D as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var n=new Set(["__proto__","constructor","prototype"]),f=new Set([...n,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);function o(e){return!n.has(e)}function u(e,t,r){o(t)&&(e[t]=r)}function c(e,t){return Object.hasOwn(e,t)}function s(e){return Object.assign(Object.create(null),e)}function i(...e){return Object.assign(Object.create(null),...e)}export{o as a,u as b,c,s as d,i as e};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as F,b as I,c as L}from"./chunk-227L3ACM.js";import{g as u,h as p,i as v,l as N}from"./chunk-RQSPCXDR.js";var w={name:"join",summary:"join lines of two files on a common field",usage:"join [OPTION]... FILE1 FILE2",description:"For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.",options:["-1 FIELD Join on this FIELD of file 1 (default: 1)","-2 FIELD Join on this FIELD of file 2 (default: 1)","-t CHAR Use CHAR as input and output field separator","-a FILENUM Also print unpairable lines from file FILENUM (1 or 2)","-v FILENUM Like -a but only output unpairable lines","-e STRING Replace missing fields with STRING","-o FORMAT Output format (comma-separated list of FILENUM.FIELD)","-i Ignore case when comparing fields"],examples:["join file1 file2 # Join on first field","join -1 2 -2 1 file1 file2 # Join file1 col 2 with file2 col 1","join -t ',' file1.csv file2.csv # Join CSV files","join -a 1 file1 file2 # Left outer join"]};function U(a,l){return l?a.split(l):a.split(/[ \t]+/).filter(i=>i.length>0)}function C(a,l,i,n){let r=U(a,l),e=r[i-1]??"";return n&&(e=e.toLowerCase()),{fields:r,joinKey:e,original:a}}function j(a,l,i){let n=i.separator??" ";if(i.outputFormat){let o=[];for(let{file:m,field:c}of i.outputFormat){let d=m===1?a:l;d&&c===0?o.push(d.joinKey):d&&d.fields[c-1]!==void 0?o.push(d.fields[c-1]):o.push(i.emptyString)}return o.join(n)}let r=[],e=a?.joinKey??l?.joinKey??"";if(r.push(e),a)for(let o=0;o<a.fields.length;o++)o!==i.field1-1&&r.push(a.fields[o]);if(l)for(let o=0;o<l.fields.length;o++)o!==i.field2-1&&r.push(l.fields[o]);return r.join(n)}function x(a){let l=a.split(","),i=[];for(let n of l){let r=n.trim().match(/^(\d+)\.(\d+)$/);if(!r)return null;let e=Number.parseInt(r[1],10),o=Number.parseInt(r[2],10);if(e!==1&&e!==2)return null;i.push({file:e,field:o})}return i}var K={name:"join",execute:async(a,l)=>{let i=N(a);if(I(i))return F(w);let n={field1:1,field2:1,separator:null,printUnpairable:new Set,onlyUnpairable:new Set,emptyString:"",outputFormat:null,ignoreCase:!1},r=[],e=0;for(;e<i.length;){let t=i[e];if(t==="-1"&&e+1<i.length){let s=Number.parseInt(i[e+1],10);if(Number.isNaN(s)||s<1)return{exitCode:1,stdout:u,stderr:p(`join: invalid field number: '${i[e+1]}'
|
|
3
|
+
`)};n.field1=s,e+=2}else if(t==="-2"&&e+1<i.length){let s=Number.parseInt(i[e+1],10);if(Number.isNaN(s)||s<1)return{exitCode:1,stdout:u,stderr:p(`join: invalid field number: '${i[e+1]}'
|
|
4
|
+
`)};n.field2=s,e+=2}else if((t==="-t"||t==="--field-separator")&&e+1<i.length)n.separator=i[e+1],e+=2;else if(t.startsWith("-t")&&t.length>2)n.separator=t.slice(2),e++;else if(t==="-a"&&e+1<i.length){let s=Number.parseInt(i[e+1],10);if(s!==1&&s!==2)return{exitCode:1,stdout:u,stderr:p(`join: invalid file number: '${i[e+1]}'
|
|
5
|
+
`)};n.printUnpairable.add(s),e+=2}else if(t.match(/^-a[12]$/))n.printUnpairable.add(Number.parseInt(t[2],10)),e++;else if(t==="-v"&&e+1<i.length){let s=Number.parseInt(i[e+1],10);if(s!==1&&s!==2)return{exitCode:1,stdout:u,stderr:p(`join: invalid file number: '${i[e+1]}'
|
|
6
|
+
`)};n.onlyUnpairable.add(s),e+=2}else if(t.match(/^-v[12]$/))n.onlyUnpairable.add(Number.parseInt(t[2],10)),e++;else if(t==="-e"&&e+1<i.length)n.emptyString=i[e+1],e+=2;else if(t==="-o"&&e+1<i.length){let s=x(i[e+1]);if(!s)return{exitCode:1,stdout:u,stderr:p(`join: invalid field spec: '${i[e+1]}'
|
|
7
|
+
`)};n.outputFormat=s,e+=2}else if(t==="-i"||t==="--ignore-case")n.ignoreCase=!0,e++;else if(t==="--"){r.push(...i.slice(e+1));break}else{if(t.startsWith("-")&&t!=="-")return L("join",t);r.push(t),e++}}if(r.length!==2)return{exitCode:1,stdout:u,stderr:p(r.length<2?`join: missing file operand
|
|
8
|
+
`:`join: extra operand
|
|
9
|
+
`)};let o=[];for(let t of r)if(t==="-")o.push(v(l.stdin));else{let s=l.fs.resolvePath(l.cwd,t),f=await l.fs.readFile(s);if(f===null)return{exitCode:1,stdout:u,stderr:p(`join: ${t}: No such file or directory
|
|
10
|
+
`)};o.push(f)}let m=(t,s)=>{let f=t.split(`
|
|
11
|
+
`);return t.endsWith(`
|
|
12
|
+
`)&&f[f.length-1]===""&&f.pop(),f.filter(b=>b.length>0).map(b=>C(b,n.separator,s,n.ignoreCase))},c=m(o[0],n.field1),d=m(o[1],n.field2),g=new Map;for(let t of d){let s=g.get(t.joinKey);s?s.push(t):g.set(t.joinKey,[t])}let h=[],y=new Set;for(let t of c){let s=g.get(t.joinKey);if(s&&s.length>0){if(y.add(t.joinKey),n.onlyUnpairable.size===0)for(let f of s)h.push(j(t,f,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&h.push(j(t,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let t of d)y.has(t.joinKey)||h.push(j(null,t,n));return{exitCode:0,stdout:p(h.length>0?`${h.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`:""),stderr:u}}},$={name:"join",flags:[{flag:"-1",type:"value",valueHint:"number"},{flag:"-2",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-a",type:"value",valueHint:"number"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"format"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{K as a,$ as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{b as q}from"./chunk-YEPWKN4F.js";import{a as h}from"./chunk-KFLJ4EMB.js";import{a as m,b as y}from"./chunk-227L3ACM.js";import{g as l,h as d,i as f,l as g}from"./chunk-RQSPCXDR.js";var P={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},A={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},z={name:"uniq",async execute(b,C){let p=g(b);if(y(p))return m(P);let o=h("uniq",p,A);if(!o.ok)return o.error;let{count:x,duplicatesOnly:O,uniqueOnly:T,ignoreCase:w}=o.result.flags,F=o.result.positional,u=await q(C,F,{cmdName:"uniq"});if(!u.ok)return u.error;let n=f(u.content).split(`
|
|
3
|
+
`);if(n.length>0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:l,stderr:l,exitCode:0};let t=[],r=n[0],i=1,L=(e,s)=>w?e.toLowerCase()===s.toLowerCase():e===s;for(let e=1;e<n.length;e++)L(n[e],r)?i++:(t.push({line:r,count:i}),r=n[e],i=1);t.push({line:r,count:i});let a=t;O?a=t.filter(e=>e.count>1):T&&(a=t.filter(e=>e.count===1));let c="";for(let{line:e,count:s}of a)x?c+=`${String(s).padStart(4)} ${e}
|
|
4
|
+
`:c+=`${e}
|
|
5
|
+
`;return{stdout:d(c),stderr:l,exitCode:0}}},I={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{z as a,I as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as d,b as p}from"./chunk-227L3ACM.js";import{g as s,h as a,l,m as h,n as c}from"./chunk-RQSPCXDR.js";var S={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},y="BASH_HISTORY",v={name:"history",async execute(m,r){let e=l(m);if(p(e))return d(S);let g=h(r.env,y,"[]"),t;try{t=JSON.parse(g)}catch{t=[]}if(e[0]==="-c")return c(r.env,y,"[]"),{stdout:s,stderr:s,exitCode:0};let n=t.length;e[0]&&/^\d+$/.test(e[0])&&(n=Math.min(parseInt(e[0],10),t.length));let u=t.length-n,i="";for(let o=u;o<t.length;o++){let f=(o+1).toString().padStart(5," ");i+=`${f} ${t[o]}
|
|
3
|
+
`}return{stdout:a(i),stderr:s,exitCode:0}}},Y={name:"history",flags:[{flag:"-c",type:"boolean"}]};export{v as a,Y as b};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as Y}from"./chunk-KFLJ4EMB.js";import{a as V,b as X}from"./chunk-227L3ACM.js";import{g as P,h as v,i as C,l as K}from"./chunk-RQSPCXDR.js";var q=(n,t,e)=>{let s=n instanceof RegExp?Q(n,e):n,r=t instanceof RegExp?Q(t,e):t,i=s!==null&&r!=null&&bt(s,r,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+s.length,i[1]),post:e.slice(i[1]+r.length)}},Q=(n,t)=>{let e=t.match(n);return e?e[0]:null},bt=(n,t,e)=>{let s,r,i,o,a,h=e.indexOf(n),f=e.indexOf(t,h+1),u=h;if(h>=0&&f>0){if(n===t)return[h,f];for(s=[],i=e.length;u>=0&&!a;){if(u===h)s.push(u),h=e.indexOf(n,u+1);else if(s.length===1){let d=s.pop();d!==void 0&&(a=[d,f])}else r=s.pop(),r!==void 0&&r<i&&(i=r,o=f),f=e.indexOf(t,u+1);u=h<f&&h>=0?h:f}s.length&&o!==void 0&&(a=[i,o])}return a};var tt="\0SLASH"+Math.random()+"\0",et="\0OPEN"+Math.random()+"\0",I="\0CLOSE"+Math.random()+"\0",st="\0COMMA"+Math.random()+"\0",nt="\0PERIOD"+Math.random()+"\0",Et=new RegExp(tt,"g"),At=new RegExp(et,"g"),Tt=new RegExp(I,"g"),Mt=new RegExp(st,"g"),vt=new RegExp(nt,"g"),Pt=/\\\\/g,Nt=/\\{/g,Ot=/\\}/g,zt=/\\,/g,Ct=/\\./g;function H(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function Dt(n){return n.replace(Pt,tt).replace(Nt,et).replace(Ot,I).replace(zt,st).replace(Ct,nt)}function Rt(n){return n.replace(Et,"\\").replace(At,"{").replace(Tt,"}").replace(Mt,",").replace(vt,".")}function it(n){if(!n)return[""];let t=[],e=q("{","}",n);if(!e)return n.split(",");let{pre:s,body:r,post:i}=e,o=s.split(",");o[o.length-1]+="{"+r+"}";let a=it(i);return i.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}function rt(n){return n?(n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),j(Dt(n),!0).map(Rt)):[]}function Wt(n){return"{"+n+"}"}function jt(n){return/^-?0\d/.test(n)}function Lt(n,t){return n<=t}function kt(n,t){return n>=t}function j(n,t){let e=[],s=q("{","}",n);if(!s)return[n];let r=s.pre,i=s.post.length?j(s.post,!1):[""];if(/\$$/.test(s.pre))for(let o=0;o<i.length;o++){let a=r+"{"+s.body+"}"+i[o];e.push(a)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),h=o||a,f=s.body.indexOf(",")>=0;if(!h&&!f)return s.post.match(/,(?!,).*\}/)?(n=s.pre+"{"+s.body+I+s.post,j(n)):[n];let u;if(h)u=s.body.split(/\.\./);else if(u=it(s.body),u.length===1&&u[0]!==void 0&&(u=j(u[0],!1).map(Wt),u.length===1))return i.map(c=>s.pre+u[0]+c);let d;if(h&&u[0]!==void 0&&u[1]!==void 0){let c=H(u[0]),l=H(u[1]),p=Math.max(u[0].length,u[1].length),g=u.length===3&&u[2]!==void 0?Math.abs(H(u[2])):1,w=Lt;l<c&&(g*=-1,w=kt);let x=u.some(jt);d=[];for(let y=c;w(y,l);y+=g){let m;if(a)m=String.fromCharCode(y),m==="\\"&&(m="");else if(m=String(y),x){let $=p-m.length;if($>0){let b=new Array($+1).join("0");y<0?m="-"+b+m.slice(1):m=b+m}}d.push(m)}}else{d=[];for(let c=0;c<u.length;c++)d.push.apply(d,j(u[c],!1))}for(let c=0;c<d.length;c++)for(let l=0;l<i.length;l++){let p=r+d[c]+i[l];(!t||h||p)&&e.push(p)}}return e}var L=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var Ft={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},k=n=>n.replace(/[[\]\\-]/g,"\\$&"),Gt=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ot=n=>n.join(""),at=(n,t)=>{let e=t;if(n.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],r=[],i=e+1,o=!1,a=!1,h=!1,f=!1,u=e,d="";t:for(;i<n.length;){let g=n.charAt(i);if((g==="!"||g==="^")&&i===e+1){f=!0,i++;continue}if(g==="]"&&o&&!h){u=i+1;break}if(o=!0,g==="\\"&&!h){h=!0,i++;continue}if(g==="["&&!h){for(let[w,[S,x,y]]of Object.entries(Ft))if(n.startsWith(w,i)){if(d)return["$.",!1,n.length-e,!0];i+=w.length,y?r.push(S):s.push(S),a=a||x;continue t}}if(h=!1,d){g>d?s.push(k(d)+"-"+k(g)):g===d&&s.push(k(g)),d="",i++;continue}if(n.startsWith("-]",i+1)){s.push(k(g+"-")),i+=2;continue}if(n.startsWith("-",i+1)){d=g,i+=2;continue}s.push(k(g)),i++}if(u<i)return["",!1,0,!1];if(!s.length&&!r.length)return["$.",!1,n.length-e,!0];if(r.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!f){let g=s[0].length===2?s[0].slice(-1):s[0];return[Gt(g),!1,u-e,!1]}let c="["+(f?"^":"")+ot(s)+"]",l="["+(f?"":"^")+ot(r)+"]";return[s.length&&r.length?"("+c+"|"+l+")":s.length?c:l,a,u-e,!0]};var N=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?n.replace(/\[([^\/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Bt=new Set(["!","?","+","*","@"]),ct=n=>Bt.has(n),_t="(?!(?:^|/)\\.\\.?(?:$|/))",F="(?!\\.)",qt=new Set(["[","."]),Ht=new Set(["..","."]),It=new Set("().*{}+?[]^$\\!"),Jt=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),J="[^/]",lt=J+"*?",ht=J+"+?",D=class n{type;#s;#n;#r=!1;#t=[];#e;#o;#c;#a=!1;#i;#l;#u=!1;constructor(t,e,s={}){this.type=t,t&&(this.#n=!0),this.#e=e,this.#s=this.#e?this.#e.#s:this,this.#i=this.#s===this?s:this.#s.#i,this.#c=this.#s===this?[]:this.#s.#c,t==="!"&&!this.#s.#a&&this.#c.push(this),this.#o=this.#e?this.#e.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#l=this.#t.map(t=>String(t)).join("")}#p(){if(this!==this.#s)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let e=t,s=e.#e;for(;s;){for(let r=e.#o+1;!s.type&&r<s.#t.length;r++)for(let i of t.#t){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(s.#t[r])}e=s,s=e.#e}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof n&&e.#e===this))throw new Error("invalid part: "+e);this.#t.push(e)}}toJSON(){let t=this.type===null?this.#t.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#t.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#s||this.#s.#a&&this.#e?.type==="!")&&t.push({}),t}isStart(){if(this.#s===this)return!0;if(!this.#e?.isStart())return!1;if(this.#o===0)return!0;let t=this.#e;for(let e=0;e<this.#o;e++){let s=t.#t[e];if(!(s instanceof n&&s.type==="!"))return!1}return!0}isEnd(){if(this.#s===this||this.#e?.type==="!")return!0;if(!this.#e?.isEnd())return!1;if(!this.type)return this.#e?.isEnd();let t=this.#e?this.#e.#t.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new n(this.type,t);for(let s of this.#t)e.copyIn(s);return e}static#h(t,e,s,r){let i=!1,o=!1,a=-1,h=!1;if(e.type===null){let l=s,p="";for(;l<t.length;){let g=t.charAt(l++);if(i||g==="\\"){i=!i,p+=g;continue}if(o){l===a+1?(g==="^"||g==="!")&&(h=!0):g==="]"&&!(l===a+2&&h)&&(o=!1),p+=g;continue}else if(g==="["){o=!0,a=l,h=!1,p+=g;continue}if(!r.noext&&ct(g)&&t.charAt(l)==="("){e.push(p),p="";let w=new n(g,e);l=n.#h(t,w,l,r),e.push(w);continue}p+=g}return e.push(p),l}let f=s+1,u=new n(null,e),d=[],c="";for(;f<t.length;){let l=t.charAt(f++);if(i||l==="\\"){i=!i,c+=l;continue}if(o){f===a+1?(l==="^"||l==="!")&&(h=!0):l==="]"&&!(f===a+2&&h)&&(o=!1),c+=l;continue}else if(l==="["){o=!0,a=f,h=!1,c+=l;continue}if(ct(l)&&t.charAt(f)==="("){u.push(c),c="";let p=new n(l,u);u.push(p),f=n.#h(t,p,f,r);continue}if(l==="|"){u.push(c),c="",d.push(u),u=new n(null,e);continue}if(l===")")return c===""&&e.#t.length===0&&(e.#u=!0),u.push(c),c="",e.push(...d,u),f;c+=l}return e.type=null,e.#n=void 0,e.#t=[t.substring(s-1)],f}static fromGlob(t,e={}){let s=new n(null,void 0,e);return n.#h(t,s,0,e),s}toMMPattern(){if(this!==this.#s)return this.#s.toMMPattern();let t=this.toString(),[e,s,r,i]=this.toRegExpSource();if(!(r||this.#n||this.#i.nocase&&!this.#i.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(this.#i.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:t})}get options(){return this.#i}toRegExpSource(t){let e=t??!!this.#i.dot;if(this.#s===this&&this.#p(),!this.type){let h=this.isStart()&&this.isEnd()&&!this.#t.some(l=>typeof l!="string"),f=this.#t.map(l=>{let[p,g,w,S]=typeof l=="string"?n.#d(l,this.#n,h):l.toRegExpSource(t);return this.#n=this.#n||w,this.#r=this.#r||S,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Ht.has(this.#t[0]))){let p=qt,g=e&&p.has(f.charAt(0))||f.startsWith("\\.")&&p.has(f.charAt(2))||f.startsWith("\\.\\.")&&p.has(f.charAt(4)),w=!e&&!t&&p.has(f.charAt(0));u=g?_t:w?F:""}let d="";return this.isEnd()&&this.#s.#a&&this.#e?.type==="!"&&(d="(?:$|\\/)"),[u+f+d,N(f),this.#n=!!this.#n,this.#r]}let s=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#f(e);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let h=this.toString();return this.#t=[h],this.type=null,this.#n=void 0,[h,N(this.toString()),!1,!1]}let o=!s||t||e||!F?"":this.#f(!0);o===i&&(o=""),o&&(i=`(?:${i})(?:${o})*?`);let a="";if(this.type==="!"&&this.#u)a=(this.isStart()&&!e?F:"")+ht;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?F:"")+lt+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=r+i+h}return[a,N(i),this.#n=!!this.#n,this.#r]}#f(t){return this.#t.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,r,i,o]=e.toRegExpSource(t);return this.#r=this.#r||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#d(t,e,s=!1){let r=!1,i="",o=!1;for(let a=0;a<t.length;a++){let h=t.charAt(a);if(r){r=!1,i+=(It.has(h)?"\\":"")+h;continue}if(h==="\\"){a===t.length-1?i+="\\\\":r=!0;continue}if(h==="["){let[f,u,d,c]=at(t,a);if(d){i+=f,o=o||u,a+=d-1,e=e||c;continue}}if(h==="*"){i+=s&&t==="*"?ht:lt,e=!0;continue}if(h==="?"){i+=J,e=!0;continue}i+=Jt(h)}return[i,N(t),!!e,o]}};var U=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var E=(n,t,e={})=>(L(t),!e.nocomment&&t.charAt(0)==="#"?!1:new R(t,e).match(n)),Ut=/^\*+([^+@!?\*\[\(]*)$/,Zt=n=>t=>!t.startsWith(".")&&t.endsWith(n),Kt=n=>t=>t.endsWith(n),Vt=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),Xt=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Yt=/^\*+\.\*+$/,Qt=n=>!n.startsWith(".")&&n.includes("."),te=n=>n!=="."&&n!==".."&&n.includes("."),ee=/^\.\*+$/,se=n=>n!=="."&&n!==".."&&n.startsWith("."),ne=/^\*+$/,ie=n=>n.length!==0&&!n.startsWith("."),re=n=>n.length!==0&&n!=="."&&n!=="..",oe=/^\?+([^+@!?\*\[\(]*)?$/,ae=([n,t=""])=>{let e=pt([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ce=([n,t=""])=>{let e=dt([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},le=([n,t=""])=>{let e=dt([n]);return t?s=>e(s)&&s.endsWith(t):e},he=([n,t=""])=>{let e=pt([n]);return t?s=>e(s)&&s.endsWith(t):e},pt=([n])=>{let t=n.length;return e=>e.length===t&&!e.startsWith(".")},dt=([n])=>{let t=n.length;return e=>e.length===t&&e!=="."&&e!==".."},gt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ut={win32:{sep:"\\"},posix:{sep:"/"}},ue=gt==="win32"?ut.win32.sep:ut.posix.sep;E.sep=ue;var M=Symbol("globstar **");E.GLOBSTAR=M;var fe="[^/]",pe=fe+"*?",de="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ge="(?:(?!(?:\\/|^)\\.).)*?",me=(n,t={})=>e=>E(e,n,t);E.filter=me;var T=(n,t={})=>Object.assign({},n,t),ye=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return E;let t=E;return Object.assign((s,r,i={})=>t(s,r,T(n,i)),{Minimatch:class extends t.Minimatch{constructor(r,i={}){super(r,T(n,i))}static defaults(r){return t.defaults(T(n,r)).Minimatch}},AST:class extends t.AST{constructor(r,i,o={}){super(r,i,T(n,o))}static fromGlob(r,i={}){return t.AST.fromGlob(r,T(n,i))}},unescape:(s,r={})=>t.unescape(s,T(n,r)),escape:(s,r={})=>t.escape(s,T(n,r)),filter:(s,r={})=>t.filter(s,T(n,r)),defaults:s=>t.defaults(T(n,s)),makeRe:(s,r={})=>t.makeRe(s,T(n,r)),braceExpand:(s,r={})=>t.braceExpand(s,T(n,r)),match:(s,r,i={})=>t.match(s,r,T(n,i)),sep:t.sep,GLOBSTAR:M})};E.defaults=ye;var mt=(n,t={})=>(L(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:rt(n));E.braceExpand=mt;var we=(n,t={})=>new R(n,t).makeRe();E.makeRe=we;var Se=(n,t,e={})=>{let s=new R(t,e);return n=n.filter(r=>s.match(r)),s.options.nonull&&!n.length&&n.push(t),n};E.match=Se;var ft=/[?*]|[+@!]\(.*?\)|\[|\]/,xe=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),R=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){L(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||gt,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map((i,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=i[0]===""&&i[1]===""&&(i[2]==="?"||!ft.test(i[2]))&&!ft.test(i[3]),f=/^[a-z]:/i.test(i[0]);if(h)return[...i.slice(0,4),...i.slice(4).map(u=>this.parse(u))];if(f)return[i[0],...i.slice(1).map(u=>this.parse(u))]}return i.map(h=>this.parse(h))});if(this.debug(this.pattern,r),this.set=r.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let o=this.set[i];o[0]===""&&o[1]===""&&this.globParts[i][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let r=0;r<t[s].length;r++)t[s][r]==="**"&&(t[s][r]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let r=s;for(;e[r+1]==="**";)r++;r!==s&&e.splice(s,r-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,r)=>{let i=s[s.length-1];return r==="**"&&i==="**"?s:r===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(s.pop(),s):(s.push(r),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let i=t[r];r===1&&i===""&&t[0]===""||(i==="."||i==="")&&(e=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let r=t[s-1];r&&r!=="."&&r!==".."&&r!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let o=r;for(;s[o+1]==="**";)o++;o>r&&s.splice(r+1,o-r);let a=s[r+1],h=s[r+2],f=s[r+3];if(a!==".."||!h||h==="."||h===".."||!f||f==="."||f==="..")continue;e=!0,s.splice(r,1);let u=s.slice(0);u[r]="**",t.push(u),r--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let i=0;for(;(i=s.indexOf("..",i+1))!==-1;){let o=s[i-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=i===1&&s[i+1]==="**"?["."]:[];s.splice(i-1,2,...h),s.length===0&&s.push(""),i-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let r=0,i=0,o=[],a="";for(;r<t.length&&i<e.length;)if(t[r]===e[i])o.push(a==="b"?e[i]:t[r]),r++,i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="b")return!1;a="a",o.push(t[r]),r++,i++}else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="a")return!1;a="b",o.push(e[i]),r++,i++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let r=this.options;if(this.isWindows){let g=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),w=!g&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),S=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),x=!S&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),y=w?3:g?0:void 0,m=x?3:S?0:void 0;if(typeof y=="number"&&typeof m=="number"){let[$,b]=[t[y],e[m]];$.toLowerCase()===b.toLowerCase()&&(e[m]=$,m>y?e=e.slice(m):y>m&&(t=t.slice(y)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,a=0,h=t.length,f=e.length;o<h&&a<f;o++,a++){this.debug("matchOne loop");var u=e[a],d=t[o];if(this.debug(e,u,d),u===!1)return!1;if(u===M){this.debug("GLOBSTAR",[e,u,d]);var c=o,l=a+1;if(l===f){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return!1;return!0}for(;c<h;){var p=t[c];if(this.debug(`
|
|
3
|
+
globstar while`,t,c,e,l,p),this.matchOne(t.slice(c),e.slice(l),s))return this.debug("globstar found match!",c,h,p),!0;if(p==="."||p===".."||!r.dot&&p.charAt(0)==="."){this.debug("dot detected!",t,c,e,l);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(s&&(this.debug(`
|
|
4
|
+
>>> no match, partial?`,t,c,e,l),c===h))}let g;if(typeof u=="string"?(g=d===u,this.debug("string match",u,d,g)):(g=u.test(d),this.debug("pattern match",u,d,g)),!g)return!1}if(o===h&&a===f)return!0;if(o===h)return s;if(a===f)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return mt(this.pattern,this.options)}parse(t){L(t);let e=this.options;if(t==="**")return M;if(t==="")return"";let s,r=null;(s=t.match(ne))?r=e.dot?re:ie:(s=t.match(Ut))?r=(e.nocase?e.dot?Xt:Vt:e.dot?Kt:Zt)(s[1]):(s=t.match(oe))?r=(e.nocase?e.dot?ce:ae:e.dot?le:he)(s):(s=t.match(Yt))?r=e.dot?te:Qt:(s=t.match(ee))&&(r=se);let i=D.fromGlob(t,this.options).toMMPattern();return r&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?pe:e.dot?de:ge,r=new Set(e.nocase?["i"]:[]),i=t.map(h=>{let f=h.map(d=>{if(d instanceof RegExp)for(let c of d.flags.split(""))r.add(c);return typeof d=="string"?xe(d):d===M?M:d._src});f.forEach((d,c)=>{let l=f[c+1],p=f[c-1];d!==M||p===M||(p===void 0?l!==void 0&&l!==M?f[c+1]="(?:\\/|"+s+"\\/)?"+l:f[c]=s:l===void 0?f[c-1]=p+"(?:\\/|\\/"+s+")?":l!==M&&(f[c-1]=p+"(?:\\/|\\/"+s+"\\/)"+l,f[c+1]=M))});let u=f.filter(d=>d!==M);if(this.partial&&u.length>=1){let d=[];for(let c=1;c<=u.length;c++)d.push(u.slice(0,c).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];i="^"+o+i+a+"$",this.partial&&(i="^(?:\\/|"+o+i.slice(1,-1)+a+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let i=this.set;this.debug(this.pattern,"set",i);let o=r[r.length-1];if(!o)for(let a=r.length-2;!o&&a>=0;a--)o=r[a];for(let a=0;a<i.length;a++){let h=i[a],f=r;if(s.matchBase&&h.length===1&&(f=[o]),this.matchOne(f,h,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return E.defaults(t).Minimatch}};E.AST=D;E.Minimatch=R;E.escape=U;E.unescape=N;function G(n){if(n<1024)return String(n);if(n<1024*1024){let e=n/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(n<1024*1024*1024){let e=n/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=n/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function B(n){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getMonth()],s=String(n.getDate()).padStart(2," "),r=new Date,i=new Date(r.getTime()-4320*60*60*1e3);if(n>i){let a=String(n.getHours()).padStart(2,"0"),h=String(n.getMinutes()).padStart(2,"0");return`${e} ${s} ${a}:${h}`}let o=n.getFullYear();return`${e} ${s} ${o}`}var $e={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},be={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},Ve={name:"ls",async execute(n,t){let e=K(n);if(X(e))return V($e);let s=Y("ls",e,be);if(!s.ok)return s.error;let r=s.result.flags.showAll,i=s.result.flags.showAlmostAll,o=s.result.flags.longFormat,a=s.result.flags.humanReadable,h=s.result.flags.recursive,f=s.result.flags.reverse,u=s.result.flags.sortBySize,d=s.result.flags.directoryOnly,c=s.result.flags.sortByTime;s.result.flags.onePerLine;let l=s.result.positional;l.length===0&&l.push(".");let p="",g="",w=0;for(let S=0;S<l.length;S++){let x=l[S];if(S>0&&p&&!p.endsWith(`
|
|
5
|
+
|
|
6
|
+
`)&&(p+=`
|
|
7
|
+
`),d){let y=t.fs.resolvePath(t.cwd,x);try{let m=await t.fs.stat(y);if(o){let $=m.isDirectory?"drwxr-xr-x":"-rw-r--r--",b=m.isDirectory?"/":"",A=m.size??0,O=a?G(A).padStart(5):String(A).padStart(5),z=m.mtime??new Date(0),_=B(z);p+=`${$} 1 user user ${O} ${_} ${x}${b}
|
|
8
|
+
`}else p+=`${x}
|
|
9
|
+
`}catch{g+=`ls: cannot access '${x}': No such file or directory
|
|
10
|
+
`,w=2}continue}if(x.includes("*")||x.includes("?")||x.includes("[")){let y=await Ee(x,t,r,i,o,f,a,u);p+=C(y.stdout),g+=C(y.stderr),y.exitCode!==0&&(w=y.exitCode)}else{let y=await yt(x,t,r,i,o,h,l.length>1,f,a,u);p+=C(y.stdout),g+=C(y.stderr),y.exitCode!==0&&(w=y.exitCode)}}return{stdout:v(p),stderr:v(g),exitCode:w}}};async function Ee(n,t,e,s,r,i=!1,o=!1,a=!1){let h=e||s,f=t.fs.getAllPaths(),u=t.fs.resolvePath(t.cwd,"."),d=[];for(let c of f){let l=c.startsWith(u)&&c.slice(u.length+1)||c;if(E(l,n)||E(c,n)){let p=l.split("/").pop()||l;if(!h&&p.startsWith("."))continue;d.push(l||c)}}if(d.length===0)return{stdout:P,stderr:v(`ls: ${n}: No such file or directory
|
|
11
|
+
`),exitCode:2};if(a){let c=[];for(let l of d){let p=t.fs.resolvePath(t.cwd,l);try{let g=await t.fs.stat(p);c.push({path:l,size:g.size??0})}catch{c.push({path:l,size:0})}}c.sort((l,p)=>p.size-l.size),d.length=0,d.push(...c.map(l=>l.path))}else d.sort();if(i&&d.reverse(),r){let c=[];for(let l of d){let p=t.fs.resolvePath(t.cwd,l);try{let g=await t.fs.stat(p),w=g.isDirectory?"drwxr-xr-x":"-rw-r--r--",S=g.isDirectory?"/":"",x=g.size??0,y=o?G(x).padStart(5):String(x).padStart(5),m=g.mtime??new Date(0),$=B(m);c.push(`${w} 1 user user ${y} ${$} ${l}${S}`)}catch{c.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${l}`)}}return{stdout:v(`${c.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`),stderr:P,exitCode:0}}return{stdout:v(`${d.join(`
|
|
14
|
+
`)}
|
|
15
|
+
`),stderr:P,exitCode:0}}async function yt(n,t,e,s,r,i,o,a=!1,h=!1,f=!1,u=!1){let d=e||s,c=t.fs.resolvePath(t.cwd,n);try{let l=await t.fs.stat(c);if(!l.isDirectory){if(r){let w=l.size??0,S=h?G(w).padStart(5):String(w).padStart(5),x=l.mtime??new Date(0),y=B(x);return{stdout:v(`-rw-r--r-- 1 user user ${S} ${y} ${n}
|
|
16
|
+
`),stderr:P,exitCode:0}}return{stdout:v(`${n}
|
|
17
|
+
`),stderr:P,exitCode:0}}let p=await t.fs.readdir(c);if(d||(p=p.filter(w=>!w.startsWith("."))),f){let w=[];for(let S of p){let x=c==="/"?`/${S}`:`${c}/${S}`;try{let y=await t.fs.stat(x);w.push({name:S,size:y.size??0})}catch{w.push({name:S,size:0})}}w.sort((S,x)=>x.size-S.size),p=w.map(S=>S.name)}else p.sort();e&&(p=[".","..",...p]),a&&p.reverse();let g="";if((i||o)&&(g+=`${n}:
|
|
18
|
+
`),r){g+=`total ${p.length}
|
|
19
|
+
`;let w=p.filter(m=>m==="."||m===".."),S=p.filter(m=>m!=="."&&m!=="..");for(let m of w)g+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${m}
|
|
20
|
+
`;let x=[];for(let m=0;m<S.length;m+=100){let $=S.slice(m,m+100),b=await Promise.all($.map(async A=>{let O=c==="/"?`/${A}`:`${c}/${A}`;try{let z=await t.fs.stat(O),_=z.isDirectory?"drwxr-xr-x":"-rw-r--r--",wt=z.isDirectory?"/":"",Z=z.size??0,St=h?G(Z).padStart(5):String(Z).padStart(5),xt=z.mtime??new Date(0),$t=B(xt);return{name:A,line:`${_} 1 user user ${St} ${$t} ${A}${wt}
|
|
21
|
+
`}}catch{return{name:A,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${A}
|
|
22
|
+
`}}}));x.push(...b)}let y=new Map(S.map((m,$)=>[m,$]));x.sort((m,$)=>(y.get(m.name)??0)-(y.get($.name)??0));for(let{line:m}of x)g+=m}else g+=p.join(`
|
|
23
|
+
`)+(p.length?`
|
|
24
|
+
`:"");if(i){let w=p.filter(y=>y!=="."&&y!==".."),S=[];if(t.fs.readdirWithFileTypes)S=(await t.fs.readdirWithFileTypes(c)).filter(m=>m.isDirectory&&w.includes(m.name)).map(m=>({name:m.name,isDirectory:!0}));else for(let y=0;y<w.length;y+=100){let m=w.slice(y,y+100),$=await Promise.all(m.map(async b=>{let A=c==="/"?`/${b}`:`${c}/${b}`;try{let O=await t.fs.stat(A);return{name:b,isDirectory:O.isDirectory}}catch{return{name:b,isDirectory:!1}}}));S.push(...$.filter(b=>b.isDirectory))}S.sort((y,m)=>y.name.localeCompare(m.name)),a&&S.reverse();let x=[];for(let y=0;y<S.length;y+=100){let m=S.slice(y,y+100),$=await Promise.all(m.map(async b=>{let A=n==="."?`./${b.name}`:`${n}/${b.name}`,O=await yt(A,t,e,s,r,i,!1,a,h,f,!0);return{name:b.name,result:O}}));x.push(...$)}x.sort((y,m)=>y.name.localeCompare(m.name)),a&&x.reverse();for(let{result:y}of x)g+=`
|
|
25
|
+
`,g+=C(y.stdout)}return{stdout:v(g),stderr:P,exitCode:0}}catch{return{stdout:P,stderr:v(`ls: ${n}: No such file or directory
|
|
26
|
+
`),exitCode:2}}}var Xe={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0};export{Ve as a,Xe as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{g as d,j as x,l as g}from"./chunk-RQSPCXDR.js";var l=new TextEncoder;function h(o,s){for(let e=0;e<s.length;e++)o.push(s[e])}function b(o){let s=[],e=0;for(;e<o.length;)if(o[e]==="\\"){if(e+1>=o.length){s.push(92);break}let a=o[e+1];switch(a){case"\\":s.push(92),e+=2;break;case"n":s.push(10),e+=2;break;case"t":s.push(9),e+=2;break;case"r":s.push(13),e+=2;break;case"a":s.push(7),e+=2;break;case"b":s.push(8),e+=2;break;case"f":s.push(12),e+=2;break;case"v":s.push(11),e+=2;break;case"e":case"E":s.push(27),e+=2;break;case"c":return{output:new Uint8Array(s),stop:!0};case"0":{let r="",t=e+2;for(;t<o.length&&t<e+5&&/[0-7]/.test(o[t]);)r+=o[t],t++;r.length===0?s.push(0):s.push(parseInt(r,8)%256),e=t;break}case"x":{let r="",t=e+2;for(;t<o.length&&t<e+4&&/[0-9a-fA-F]/.test(o[t]);)r+=o[t],t++;r.length===0?(s.push(92,120),e+=2):(s.push(parseInt(r,16)),e=t);break}case"u":{let r="",t=e+2;for(;t<o.length&&t<e+6&&/[0-9a-fA-F]/.test(o[t]);)r+=o[t],t++;if(r.length===0)h(s,l.encode("\\u")),e+=2;else{let f=parseInt(r,16);h(s,l.encode(String.fromCodePoint(f))),e=t}break}case"U":{let r="",t=e+2;for(;t<o.length&&t<e+10&&/[0-9a-fA-F]/.test(o[t]);)r+=o[t],t++;if(r.length===0)h(s,l.encode("\\U")),e+=2;else{let f=parseInt(r,16);try{h(s,l.encode(String.fromCodePoint(f)))}catch{h(s,l.encode(`\\U${r}`))}e=t}break}default:h(s,l.encode(`\\${a}`)),e+=2}}else{let a=o.charCodeAt(e);if(a<128)s.push(a),e++;else{let r=a>=55296&&a<=56319&&e+1<o.length?o.slice(e,e+2):o[e];h(s,l.encode(r)),e+=r.length}}return{output:new Uint8Array(s),stop:!1}}var w={name:"echo",async execute(o,s){let e=g(o),a=!1,r=s.xpgEcho??!1,t=0;for(;t<e.length;){let n=e[t];if(n==="-n")a=!0,t++;else if(n==="-e")r=!0,t++;else if(n==="-E")r=!1,t++;else if(n==="-ne"||n==="-en")a=!0,r=!0,t++;else break}if(r){let n=e.slice(t).join(" "),u=b(n);return u.stop?{stdout:u.output,stderr:d,exitCode:0}:{stdout:a?u.output:x(u.output,new Uint8Array([10])),stderr:d,exitCode:0}}let f=new Uint8Array([32]),p=new Uint8Array([10]),i=o.slice(t),c=d;for(let n=0;n<i.length;n++)n>0&&(c=x(c,f)),c=x(c,i[n]);return a||(c=x(c,p)),{stdout:c,stderr:d,exitCode:0}}},A={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0};export{w as a,A as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{c as f}from"./chunk-F46CSMUF.js";import{a as m,b as p}from"./chunk-227L3ACM.js";import{g as i,h,i as d,l as u}from"./chunk-RQSPCXDR.js";var g={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},v={name:"bash",async execute(l,t){let e=u(l);if(p(e))return m(g);if(e[0]==="-c"&&e.length>=2){let n=e[1],r=e[2]||"bash",o=e.slice(3);return c(n,r,o,t)}if(e.length===0)return t.stdin?.length&&d(t.stdin).trim()?c(d(t.stdin),"bash",[],t):{stdout:i,stderr:i,exitCode:0};let s=e[0],a=e.slice(1);try{let n=t.fs.resolvePath(t.cwd,s),r=await t.fs.readFile(n);return c(r,s,a,t)}catch{return{stdout:i,stderr:h(`bash: ${s}: No such file or directory
|
|
3
|
+
`),exitCode:127}}}},w={name:"sh",async execute(l,t){let e=u(l);if(p(e))return m({...g,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let n=e[1],r=e[2]||"sh",o=e.slice(3);return c(n,r,o,t)}if(e.length===0)return t.stdin?.length&&d(t.stdin).trim()?c(d(t.stdin),"sh",[],t):{stdout:i,stderr:i,exitCode:0};let s=e[0],a=e.slice(1);try{let n=t.fs.resolvePath(t.cwd,s),r=await t.fs.readFile(n);return c(r,s,a,t)}catch{return{stdout:i,stderr:h(`sh: ${s}: No such file or directory
|
|
4
|
+
`),exitCode:127}}}};async function c(l,t,e,s){if(!s.exec)return{stdout:i,stderr:h(`bash: internal error: exec function not available
|
|
5
|
+
`),exitCode:1};let a=f(s.exportedEnv||{},{0:t,"#":String(e.length),"@":e.join(" "),"*":e.join(" ")});e.forEach((o,y)=>{a[String(y+1)]=o});let n=l;if(n.startsWith("#!")){let o=n.indexOf(`
|
|
6
|
+
`);o!==-1&&(n=n.slice(o+1))}return await s.exec(n,{env:a,cwd:s.cwd,stdin:s.stdin})}var F={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},N={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"};export{v as a,w as b,F as c,N as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{g as e}from"./chunk-RQSPCXDR.js";var r={name:"true",async execute(){return{stdout:e,stderr:e,exitCode:0}}},o={name:"false",async execute(){return{stdout:e,stderr:e,exitCode:1}}},s={name:"true",flags:[]},a={name:"false",flags:[]};export{r as a,o as b,s as c,a as d};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{g as c,h as m,j as h}from"./chunk-RQSPCXDR.js";async function P(t,n,a){let{cmdName:r,allowStdinMarker:d=!0,stopOnError:i=!1,batchSize:o=100}=a;if(n.length===0)return{files:[{filename:"",content:t.stdin}],stderr:"",exitCode:0};let l=[],f="",u=0;for(let s=0;s<n.length;s+=o){let p=n.slice(s,s+o),C=await Promise.all(p.map(async e=>{if(d&&e==="-")return{filename:"-",content:t.stdin,error:null};try{let w=t.fs.resolvePath(t.cwd,e),y=await t.fs.readFileBuffer(w);return{filename:e,content:y,error:null}}catch{return{filename:e,content:c,error:`${r}: ${e}: No such file or directory
|
|
3
|
+
`}}}));for(let e of C)if(e.error){if(f+=e.error,u=1,i)return{files:l,stderr:f,exitCode:u}}else l.push({filename:e.filename,content:e.content})}return{files:l,stderr:f,exitCode:u}}async function x(t,n,a){let r=await P(t,n,{...a,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:c,stderr:m(r.stderr),exitCode:r.exitCode}}:{ok:!0,content:r.files.reduce((i,o)=>h(i,o.content),c)}}export{P as a,x as b};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as z}from"./chunk-KFLJ4EMB.js";import{a as O,b as W}from"./chunk-227L3ACM.js";import{g as L,h as b,i as F,l as N}from"./chunk-RQSPCXDR.js";var k=class{diff(e,t,n={}){let s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);let c=this.castInput(e,n),f=this.castInput(t,n),r=this.removeEmpty(this.tokenize(c,n)),l=this.removeEmpty(this.tokenize(f,n));return this.diffWithOptionsObj(r,l,n,s)}diffWithOptionsObj(e,t,n,s){var c;let f=i=>{if(i=this.postProcess(i,n),s){setTimeout(function(){s(i)},0);return}else return i},r=t.length,l=e.length,u=1,o=r+l;n.maxEditLength!=null&&(o=Math.min(o,n.maxEditLength));let h=(c=n.timeout)!==null&&c!==void 0?c:1/0,C=Date.now()+h,m=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(m[0],t,e,0,n);if(m[0].oldPos+1>=l&&p+1>=r)return f(this.buildValues(m[0].lastComponent,t,e));let g=-1/0,y=1/0,x=()=>{for(let i=Math.max(g,-u);i<=Math.min(y,u);i+=2){let d,w=m[i-1],P=m[i+1];w&&(m[i-1]=void 0);let v=!1;if(P){let A=P.oldPos-i;v=P&&0<=A&&A<r}let T=w&&w.oldPos+1<l;if(!v&&!T){m[i]=void 0;continue}if(!T||v&&w.oldPos<P.oldPos?d=this.addToPath(P,!0,!1,0,n):d=this.addToPath(w,!1,!0,1,n),p=this.extractCommon(d,t,e,i,n),d.oldPos+1>=l&&p+1>=r)return f(this.buildValues(d.lastComponent,t,e))||!0;m[i]=d,d.oldPos+1>=l&&(y=Math.min(y,i-1)),p+1>=r&&(g=Math.max(g,i+1))}u++};if(s)(function i(){setTimeout(function(){if(u>o||Date.now()>C)return s(void 0);x()||i()},0)})();else for(;u<=o&&Date.now()<=C;){let i=x();if(i)return i}}addToPath(e,t,n,s,c){let f=e.lastComponent;return f&&!c.oneChangePerToken&&f.added===t&&f.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:t,removed:n,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:f}}}extractCommon(e,t,n,s,c){let f=t.length,r=n.length,l=e.oldPos,u=l-s,o=0;for(;u+1<f&&l+1<r&&this.equals(n[l+1],t[u+1],c);)u++,l++,o++,c.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return o&&!c.oneChangePerToken&&(e.lastComponent={count:o,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let s=[],c;for(;e;)s.push(e),c=e.previousComponent,delete e.previousComponent,e=c;s.reverse();let f=s.length,r=0,l=0,u=0;for(;r<f;r++){let o=s[r];if(o.removed)o.value=this.join(n.slice(u,u+o.count)),u+=o.count;else{if(!o.added&&this.useLongestToken){let h=t.slice(l,l+o.count);h=h.map(function(C,m){let p=n[u+m];return p.length>C.length?p:C}),o.value=this.join(h)}else o.value=this.join(t.slice(l,l+o.count));l+=o.count,o.added||(u+=o.count)}}return s}};var j=class extends k{constructor(){super(...arguments),this.tokenize=q}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
3
|
+
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
4
|
+
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
5
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
6
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},M=new j;function I(a,e,t){return M.diff(a,e,t)}function q(a,e){e.stripTrailingCr&&(a=a.replace(/\r\n/g,`
|
|
7
|
+
`));let t=[],n=a.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let s=0;s<n.length;s++){let c=n[s];s%2&&!e.newlineIsToken?t[t.length-1]+=c:t.push(c)}return t}function E(a,e,t,n,s,c,f){let r;f?typeof f=="function"?r={callback:f}:r=f:r={},typeof r.context>"u"&&(r.context=4);let l=r.context;if(r.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(r.callback){let{callback:o}=r;I(t,n,Object.assign(Object.assign({},r),{callback:h=>{let C=u(h);o(C)}}))}else return u(I(t,n,r));function u(o){if(!o)return;o.push({value:"",lines:[]});function h(i){return i.map(function(d){return" "+d})}let C=[],m=0,p=0,g=[],y=1,x=1;for(let i=0;i<o.length;i++){let d=o[i],w=d.lines||H(d.value);if(d.lines=w,d.added||d.removed){if(!m){let P=o[i-1];m=y,p=x,P&&(g=l>0?h(P.lines.slice(-l)):[],m-=g.length,p-=g.length)}for(let P of w)g.push((d.added?"+":"-")+P);d.added?x+=w.length:y+=w.length}else{if(m)if(w.length<=l*2&&i<o.length-2)for(let P of h(w))g.push(P);else{let P=Math.min(w.length,l);for(let T of h(w.slice(0,P)))g.push(T);let v={oldStart:m,oldLines:y-m+P,newStart:p,newLines:x-p+P,lines:g};C.push(v),m=0,p=0,g=[]}y+=w.length,x+=w.length}}for(let i of C)for(let d=0;d<i.lines.length;d++)i.lines[d].endsWith(`
|
|
8
|
+
`)?i.lines[d]=i.lines[d].slice(0,-1):(i.lines.splice(d+1,0,"\"),d++);return{oldFileName:a,newFileName:e,oldHeader:s,newHeader:c,hunks:C}}}function D(a){if(Array.isArray(a))return a.map(D).join(`
|
|
9
|
+
`);let e=[];a.oldFileName==a.newFileName&&e.push("Index: "+a.oldFileName),e.push("==================================================================="),e.push("--- "+a.oldFileName+(typeof a.oldHeader>"u"?"":" "+a.oldHeader)),e.push("+++ "+a.newFileName+(typeof a.newHeader>"u"?"":" "+a.newHeader));for(let t=0;t<a.hunks.length;t++){let n=a.hunks[t];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),e.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)e.push(s)}return e.join(`
|
|
10
|
+
`)+`
|
|
11
|
+
`}function S(a,e,t,n,s,c,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){let{callback:r}=f;E(a,e,t,n,s,c,Object.assign(Object.assign({},f),{callback:l=>{r(l?D(l):void 0)}}))}else{let r=E(a,e,t,n,s,c,f);return r?D(r):void 0}}function H(a){let e=a.endsWith(`
|
|
12
|
+
`),t=a.split(`
|
|
13
|
+
`).map(n=>n+`
|
|
14
|
+
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}var R={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},V={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},ee={name:"diff",async execute(a,e){let t=N(a);if(W(t))return O(R);let n=z("diff",t,V);if(!n.ok)return n.error;let s=n.result.flags.brief,c=n.result.flags.reportSame,f=n.result.flags.ignoreCase,r=n.result.positional;if(n.result.flags.unified,r.length<2)return{stdout:L,stderr:b(`diff: missing operand
|
|
15
|
+
`),exitCode:2};let l,u,[o,h]=r;try{l=o==="-"?e.stdin:await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,o))}catch{return{stdout:L,stderr:b(`diff: ${o}: No such file or directory
|
|
16
|
+
`),exitCode:2}}try{u=h==="-"?e.stdin:await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,h))}catch{return{stdout:L,stderr:b(`diff: ${h}: No such file or directory
|
|
17
|
+
`),exitCode:2}}let C=l.length===u.length&&l.every((x,i)=>x===u[i]),m=F(l),p=F(u),g=C;if(!g&&f&&(g=m.toLowerCase()===p.toLowerCase()),g)return c?{stdout:b(`Files ${o} and ${h} are identical
|
|
18
|
+
`),stderr:L,exitCode:0}:{stdout:L,stderr:L,exitCode:0};if(s)return{stdout:b(`Files ${o} and ${h} differ
|
|
19
|
+
`),stderr:L,exitCode:1};let y=S(o,h,m,p,"","",{context:3});return{stdout:b(y),stderr:L,exitCode:1}}},ne={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{ee as a,ne as b};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as he}from"./chunk-F46CSMUF.js";import{a as A,b as _}from"./chunk-SE4C7FJY.js";import{k as L}from"./chunk-QT2GMJRJ.js";import{a as le,b as ue,c as Z}from"./chunk-227L3ACM.js";import{g as P,h as I,i as $,l as ce}from"./chunk-RQSPCXDR.js";var _e=1e4,Ge=100,De=new _(/\s+/);function Y(e={}){let{fieldSep:t=De,maxIterations:n=_e,maxRecursionDepth:i=Ge,maxOutputSize:s=0,fs:a,cwd:o,exec:c,coverage:l}=e;return{FS:" ",OFS:" ",ORS:`
|
|
3
|
+
`,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:i,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:a,cwd:o,exec:c,coverage:l}}function pe(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function b(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function v(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function W(e,t){if(e.type==="regex")return e.pattern;let n=v(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function de(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(b(await t.evalExpr(e.index)))}`:"$0":"$0"}function Ee(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return v(t.vars[e]??"")}function Ne(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let i=parseInt(e.slice(1),10)-1;for(;n.fields.length<=i;)n.fields.push("");n.fields[i]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function xe(e,t,n){return e.length===0?t.line.length:v(await n.evalExpr(e[0])).length}async function Ue(e,t,n){if(e.length<2)return"";let i=v(await n.evalExpr(e[0])),s=Math.floor(b(await n.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(b(await n.evalExpr(e[2])));return i.substr(Math.max(0,s),a)}return i.substr(Math.max(0,s))}async function Be(e,t,n){if(e.length<2)return 0;let i=v(await n.evalExpr(e[0])),s=v(await n.evalExpr(e[1])),a=i.indexOf(s);return a===-1?0:a+1}async function He(e,t,n){if(e.length<2)return 0;let i=v(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let l=e[2];if(l.type==="regex")o=A(l.pattern);else{let N=v(await n.evalExpr(l));o=N===" "?A("\\s+"):N}}else t.FS===" "&&(o=A("\\s+"));let c=typeof o=="string"?i.split(o):o.split(i);t.arrays[a]=Object.create(null);for(let l=0;l<c.length;l++)t.arrays[a][String(l+1)]=c[l];return c.length}async function $e(e,t,n){if(e.length<2)return 0;let i=await W(e[0],n),s=v(await n.evalExpr(e[1])),a=await de(e[2],n),o=Ee(a,t);try{let l=A(i).replace(o,Se(s)),N=l!==o?1:0;return Ne(a,l,t),N}catch{return 0}}async function We(e,t,n){if(e.length<2)return 0;let i=await W(e[0],n),s=v(await n.evalExpr(e[1])),a=await de(e[2],n),o=Ee(a,t);try{let c=A(i,"g"),l=c.match(o),N=l?l.length:0,w=c.replace(o,Se(s));return Ne(a,w,t),N}catch{return 0}}function Se(e){return t=>{let n="",i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let s=e[i+1];s==="&"?(n+="&",i+=2):s==="\\"?(n+="\\",i+=2):(n+=e[i+1],i+=2)}else e[i]==="&"?(n+=t,i++):(n+=e[i],i++);return n}}async function Ve(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let i=v(await n.evalExpr(e[0])),s=await W(e[1],n);try{let o=A(s).exec(i);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function Ke(e,t,n){if(e.length<3)return"";let i=await W(e[0],n),s=v(await n.evalExpr(e[1])),a=v(await n.evalExpr(e[2])),o=e.length>=4?v(await n.evalExpr(e[3])):t.line;try{let c=a.toLowerCase()==="g",l=c?0:parseInt(a,10)||1;if(c)return A(i,"g").replace(o,(w,...M)=>fe(s,w,M.slice(0,-2)));{let N=0;return A(i,"g").replace(o,(M,...y)=>(N++,N===l?fe(s,M,y.slice(0,-2)):M))}}catch{return o}}function fe(e,t,n){let i="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];if(a==="&")i+="&",s+=2;else if(a==="0")i+=t,s+=2;else if(a>="1"&&a<="9"){let o=parseInt(a,10)-1;i+=n[o]||"",s+=2}else a==="n"?(i+=`
|
|
4
|
+
`,s+=2):a==="t"?(i+=" ",s+=2):(i+=a,s+=2)}else e[s]==="&"?(i+=t,s++):(i+=e[s],s++);return i}async function Xe(e,t,n){return e.length===0?"":v(await n.evalExpr(e[0])).toLowerCase()}async function je(e,t,n){return e.length===0?"":v(await n.evalExpr(e[0])).toUpperCase()}async function ze(e,t,n){if(e.length===0)return"";let i=v(await n.evalExpr(e[0])),s=[];for(let a=1;a<e.length;a++)s.push(await n.evalExpr(e[a]));return V(i,s)}async function Qe(e,t,n){return e.length===0?0:Math.floor(b(await n.evalExpr(e[0])))}async function qe(e,t,n){return e.length===0?0:Math.sqrt(b(await n.evalExpr(e[0])))}async function Je(e,t,n){return e.length===0?0:Math.sin(b(await n.evalExpr(e[0])))}async function Ze(e,t,n){return e.length===0?0:Math.cos(b(await n.evalExpr(e[0])))}async function Ye(e,t,n){let i=e.length>0?b(await n.evalExpr(e[0])):0,s=e.length>1?b(await n.evalExpr(e[1])):0;return Math.atan2(i,s)}async function et(e,t,n){return e.length===0?0:Math.log(b(await n.evalExpr(e[0])))}async function tt(e,t,n){return e.length===0?1:Math.exp(b(await n.evalExpr(e[0])))}function nt(e,t,n){return t.random?t.random():Math.random()}async function rt(e,t,n){let i=e.length>0?b(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function it(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function ee(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var T=1e4;function V(e,t){let n=0,i="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let a=s+1,o="",c="",l="",N,w=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>w&&e[a]==="$"?(N=parseInt(e.substring(w,a),10)-1,a++):a=w;let M=()=>{if(a<e.length){if(a+1<e.length&&(e[a]==="h"&&e[a+1]==="h"||e[a]==="l"&&e[a+1]==="l")){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]==="*"){let E=t[n++],h=E!==void 0?Math.floor(Number(E)):0;h<0?(o+="-",c=String(Math.min(-h,T))):c=String(Math.min(h,T)),a++}else for(;a<e.length&&/\d/.test(e[a]);)c+=e[a++];if(c&&parseInt(c,10)>T&&(c=String(T)),e[a]==="."){if(a++,e[a]==="*"){let E=t[n++];l=String(Math.min(E!==void 0?Math.floor(Number(E)):0,T)),a++}else for(;a<e.length&&/\d/.test(e[a]);)l+=e[a++];l&&parseInt(l,10)>T&&(l=String(T))}M();let y=e[a],g=t[N!==void 0?N:n];switch(y){case"s":{let E=g!==void 0?String(g):"";if(l&&(E=E.substring(0,parseInt(l,10))),c){let h=parseInt(c,10);o.includes("-")?E=E.padEnd(h):E=E.padStart(h)}i+=E,N===void 0&&n++;break}case"d":case"i":{let E=g!==void 0?Math.floor(Number(g)):0;Number.isNaN(E)&&(E=0);let h=E<0,p=Math.abs(E).toString();if(l){let O=parseInt(l,10);p=p.padStart(O,"0")}let f="";h?f="-":o.includes("+")?f="+":o.includes(" ")&&(f=" ");let R=f+p;if(c){let O=parseInt(c,10);o.includes("-")?R=R.padEnd(O):o.includes("0")&&!l?R=f+p.padStart(O-f.length,"0"):R=R.padStart(O)}i+=R,N===void 0&&n++;break}case"f":{let E=g!==void 0?Number(g):0;Number.isNaN(E)&&(E=0);let h=l?parseInt(l,10):6,p=E.toFixed(h);if(c){let f=parseInt(c,10);o.includes("-")?p=p.padEnd(f):p=p.padStart(f)}i+=p,N===void 0&&n++;break}case"e":case"E":{let E=g!==void 0?Number(g):0;Number.isNaN(E)&&(E=0);let h=l?parseInt(l,10):6,p=E.toExponential(h);if(y==="E"&&(p=p.toUpperCase()),c){let f=parseInt(c,10);o.includes("-")?p=p.padEnd(f):p=p.padStart(f)}i+=p,N===void 0&&n++;break}case"g":case"G":{let E=g!==void 0?Number(g):0;Number.isNaN(E)&&(E=0);let h=l?parseInt(l,10):6,p=E!==0?Math.floor(Math.log10(Math.abs(E))):0,f;if(E===0?f="0":p<-4||p>=h?(f=E.toExponential(h-1),y==="G"&&(f=f.toUpperCase())):f=E.toPrecision(h),f.includes(".")&&(f=f.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),f.includes("e")&&(f=f.replace(/\.?0+e/,"e")),c){let R=parseInt(c,10);o.includes("-")?f=f.padEnd(R):f=f.padStart(R)}i+=f,N===void 0&&n++;break}case"x":case"X":{let E=g!==void 0?Math.floor(Number(g)):0;Number.isNaN(E)&&(E=0);let h=Math.abs(E).toString(16);if(y==="X"&&(h=h.toUpperCase()),l){let R=parseInt(l,10);h=h.padStart(R,"0")}let p=E<0?"-":"",f=p+h;if(c){let R=parseInt(c,10);o.includes("-")?f=f.padEnd(R):o.includes("0")&&!l?f=p+h.padStart(R-p.length,"0"):f=f.padStart(R)}i+=f,N===void 0&&n++;break}case"o":{let E=g!==void 0?Math.floor(Number(g)):0;Number.isNaN(E)&&(E=0);let h=Math.abs(E).toString(8);if(l){let R=parseInt(l,10);h=h.padStart(R,"0")}let p=E<0?"-":"",f=p+h;if(c){let R=parseInt(c,10);o.includes("-")?f=f.padEnd(R):o.includes("0")&&!l?f=p+h.padStart(R-p.length,"0"):f=f.padStart(R)}i+=f,N===void 0&&n++;break}case"c":{typeof g=="number"?i+=String.fromCharCode(g):i+=String(g??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(s,a+1)}s=a+1}else if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];switch(a){case"n":i+=`
|
|
5
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"\\":i+="\\";break;default:i+=a}s+=2}else i+=e[s++];return i}var ye=new Map([["length",xe],["substr",Ue],["index",Be],["split",He],["sub",$e],["gsub",We],["match",Ve],["gensub",Ke],["tolower",Xe],["toupper",je],["sprintf",ze],["int",Qe],["sqrt",qe],["sin",Je],["cos",Ze],["atan2",Ye],["log",et],["exp",tt],["rand",nt],["srand",rt],["system",it("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",ee("systime")],["mktime",ee("mktime")],["strftime",ee("strftime")]]);function k(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function m(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function S(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function te(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function U(e,t){try{return A(e).test(t)}catch{return!1}}function Re(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function K(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function ne(e,t,n){if(t===0)e.line=S(n),e.fields=Re(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=S(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function G(e,t){e.line=t,e.fields=Re(e,t),e.NF=e.fields.length}function me(e,t){if(e.FS=t,t===" ")e.fieldSep=new _(/\s+/);else try{e.fieldSep=A(t)}catch{e.fieldSep=A(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function X(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function D(e,t,n){switch(t){case"FS":me(e,S(n));return;case"OFS":e.OFS=S(n);return;case"ORS":e.ORS=S(n);return;case"OFMT":e.OFMT=S(n);return;case"NR":e.NR=Math.floor(m(n));return;case"NF":{let i=Math.floor(m(n));if(i<e.NF)e.fields=e.fields.slice(0,i),e.line=e.fields.join(e.OFS);else if(i>e.NF){for(;e.fields.length<i;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=i;return}case"FNR":e.FNR=Math.floor(m(n));return;case"FILENAME":e.FILENAME=S(n);return;case"RSTART":e.RSTART=Math.floor(m(n));return;case"RLENGTH":e.RLENGTH=Math.floor(m(n));return;case"SUBSEP":e.SUBSEP=S(n);return}e.vars[t]=n}function B(e,t){let n=t,i=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!i.has(n);)i.add(n),n=s,s=e.arrayAliases.get(n);return n}function j(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let i=B(e,t);return e.arrays[i]?.[n]??""}function re(e,t,n,i){let s=B(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=i}function Ae(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let i=B(e,t);return e.arrays[i]?.[n]!==void 0}function ge(e,t,n){let i=B(e,t);e.arrays[i]&&delete e.arrays[i][n]}function we(e,t){let n=B(e,t);delete e.arrays[n]}var ie=null;function Ie(e){ie=e}async function d(e,t){switch(e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return U(t.pattern,e.line)?1:0;case"field":return st(e,t);case"variable":return X(e,t.name);case"array_access":return at(e,t);case"binary":return ot(e,t);case"unary":return ut(e,t);case"ternary":return k(await d(e,t.condition))?await d(e,t.consequent):await d(e,t.alternate);case"call":return ht(e,t.name,t.args);case"assignment":return ft(e,t);case"pre_increment":return dt(e,t.operand);case"pre_decrement":return Et(e,t.operand);case"post_increment":return Nt(e,t.operand);case"post_decrement":return St(e,t.operand);case"in":return yt(e,t.key,t.array);case"getline":return Rt(e,t.variable,t.file,t.command);case"tuple":return gt(e,t.elements);default:return""}}async function st(e,t){let n=Math.floor(m(await d(e,t.index)));return K(e,n)}async function at(e,t){let n=S(await d(e,t.key));return j(e,t.array,n)}async function ot(e,t){let n=t.operator;if(n==="||")return k(await d(e,t.left))||k(await d(e,t.right))?1:0;if(n==="&&")return k(await d(e,t.left))&&k(await d(e,t.right))?1:0;if(n==="~"){let c=await d(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:S(await d(e,t.right));try{return A(l).test(S(c))?1:0}catch{return 0}}if(n==="!~"){let c=await d(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:S(await d(e,t.right));try{return A(l).test(S(c))?0:1}catch{return 1}}let i=await d(e,t.left),s=await d(e,t.right);if(n===" "){let c=S(i)+S(s);if(e.maxOutputSize>0&&c.length>e.maxOutputSize)throw new L(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",I(e.output));return c}if(ct(n))return lt(i,s,n);let a=m(i),o=m(s);return pe(a,o,n)}function ct(e){return["<","<=",">",">=","==","!="].includes(e)}function lt(e,t,n){let i=te(e),s=te(t);if(i&&s){let c=m(e),l=m(t);switch(n){case"<":return c<l?1:0;case"<=":return c<=l?1:0;case">":return c>l?1:0;case">=":return c>=l?1:0;case"==":return c===l?1:0;case"!=":return c!==l?1:0}}let a=S(e),o=S(t);switch(n){case"<":return a<o?1:0;case"<=":return a<=o?1:0;case">":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function ut(e,t){let n=await d(e,t.operand);switch(t.operator){case"!":return k(n)?0:1;case"-":return-m(n);case"+":return+m(n);default:return n}}async function ht(e,t,n){let i=ye.get(t);if(i)return i(n,e,{evalExpr:a=>d(e,a)});let s=e.functions.get(t);return s?pt(e,s,n):""}async function pt(e,t,n){if(e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new L(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",I(e.output));let i=Object.create(null);for(let o of t.params)i[o]=e.vars[o];let s=[];for(let o=0;o<t.params.length;o++){let c=t.params[o];if(o<n.length){let l=n[o];l.type==="variable"&&(e.arrayAliases.set(c,l.name),s.push(c));let N=await d(e,l);e.vars[c]=N}else e.vars[c]=""}e.hasReturn=!1,e.returnValue=void 0,ie&&await ie(e,t.body.statements);let a=e.returnValue??"";for(let o of t.params)i[o]!==void 0?e.vars[o]=i[o]:delete e.vars[o];for(let o of s)e.arrayAliases.delete(o);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,a}async function ft(e,t){let n=await d(e,t.value),i=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(i.type==="field"){let N=Math.floor(m(await d(e,i.index)));o=K(e,N)}else if(i.type==="variable")o=X(e,i.name);else{let N=S(await d(e,i.key));o=j(e,i.array,N)}let c=m(o),l=m(n);switch(s){case"+=":a=c+l;break;case"-=":a=c-l;break;case"*=":a=c*l;break;case"/=":a=l!==0?c/l:0;break;case"%=":a=l!==0?c%l:0;break;case"^=":a=c**l;break;default:a=n}}if(i.type==="field"){let o=Math.floor(m(await d(e,i.index)));ne(e,o,a)}else if(i.type==="variable")D(e,i.name,a);else{let o=S(await d(e,i.key));re(e,i.array,o,a)}return a}async function z(e,t,n,i){let s;if(t.type==="field"){let a=Math.floor(m(await d(e,t.index)));s=m(K(e,a)),ne(e,a,s+n)}else if(t.type==="variable")s=m(X(e,t.name)),D(e,t.name,s+n);else{let a=S(await d(e,t.key));s=m(j(e,t.array,a)),re(e,t.array,a,s+n)}return i?s+n:s}async function dt(e,t){return z(e,t,1,!0)}async function Et(e,t){return z(e,t,-1,!0)}async function Nt(e,t){return z(e,t,1,!1)}async function St(e,t){return z(e,t,-1,!1)}async function yt(e,t,n){let i;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(S(await d(e,a)));i=s.join(e.SUBSEP)}else i=S(await d(e,t));return Ae(e,n,i)?1:0}async function Rt(e,t,n,i){if(i)return mt(e,t,i);if(n)return At(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?D(e,t,a):G(e,a),e.NR++,e.lineIndex=s,1}async function mt(e,t,n){if(!e.exec)return-1;let i=S(await d(e,n)),s=`__cmd_${i}`,a=`__cmdi_${i}`,o,c;if(e.vars[s]===void 0)try{o=(await e.exec(i)).stdout.split(`
|
|
6
|
+
`),o.length>0&&o[o.length-1]===""&&o.pop(),e.vars[s]=JSON.stringify(o),e.vars[a]=-1,c=-1}catch{return-1}else o=JSON.parse(e.vars[s]),c=e.vars[a];let l=c+1;if(l>=o.length)return 0;let N=o[l];return e.vars[a]=l,t?D(e,t,N):G(e,N),1}async function At(e,t,n){if(!e.fs||!e.cwd)return-1;let i=S(await d(e,n));if(i==="/dev/null")return 0;let s=e.fs.resolvePath(e.cwd,i),a=`__fc_${s}`,o=`__fi_${s}`,c,l;if(e.vars[a]===void 0)try{c=(await e.fs.readFile(s)).split(`
|
|
7
|
+
`),c.length>0&&c[c.length-1]===""&&c.pop(),e.vars[a]=JSON.stringify(c),e.vars[o]=-1,l=-1}catch{return-1}else c=JSON.parse(e.vars[a]),l=e.vars[o];let N=l+1;if(N>=c.length)return 0;let w=c[N];return e.vars[o]=N,t?D(e,t,w):G(e,w),1}async function gt(e,t){if(t.length===0)return"";for(let n=0;n<t.length-1;n++)await d(e,t[n]);return d(e,t[t.length-1])}Ie(x);function se(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new L(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",I(e.output))}async function x(e,t){for(let n of t)if(await F(e,n),wt(e))break}function wt(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function F(e,t){switch(e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await x(e,t.statements);break;case"expr_stmt":await d(e,t.expression);break;case"print":await It(e,t.args,t.output);break;case"printf":await vt(e,t.format,t.args,t.output);break;case"if":await kt(e,t);break;case"while":await Ct(e,t);break;case"do_while":await Ot(e,t);break;case"for":await bt(e,t);break;case"for_in":await Lt(e,t);break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0,e.exitCode=t.code?Math.floor(m(await d(e,t.code))):0;break;case"return":e.hasReturn=!0,e.returnValue=t.value?await d(e,t.value):"";break;case"delete":await Mt(e,t.target);break}}async function It(e,t,n){let i=[];for(let a of t){let o=await d(e,a);typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?i.push(String(o)):i.push(V(e.OFMT,[o])):i.push(S(o))}let s=i.join(e.OFS)+e.ORS;n?await ve(e,n.redirect,n.file,s):(e.output+=s,se(e))}async function vt(e,t,n,i){let s=S(await d(e,t)),a=[];for(let c of n)a.push(await d(e,c));let o=V(s,a);i?await ve(e,i.redirect,i.file,o):(e.output+=o,se(e))}async function ve(e,t,n,i){if(!e.fs||!e.cwd){e.output+=i,se(e);return}let s=S(await d(e,n)),a=e.fs.resolvePath(e.cwd,s);t===">"?e.openedFiles.has(a)?await e.fs.appendFile(a,i):(await e.fs.writeFile(a,i),e.openedFiles.add(a)):(e.openedFiles.has(a)||e.openedFiles.add(a),await e.fs.appendFile(a,i))}async function kt(e,t){k(await d(e,t.condition))?await F(e,t.consequent):t.alternate&&await F(e,t.alternate)}async function Ct(e,t){let n=0;for(;k(await d(e,t.condition));){if(n++,n>e.maxIterations)throw new L(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",I(e.output));if(e.loopContinue=!1,await F(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Ot(e,t){let n=0;do{if(n++,n>e.maxIterations)throw new L(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",I(e.output));if(e.loopContinue=!1,await F(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(k(await d(e,t.condition)))}async function bt(e,t){t.init&&await d(e,t.init);let n=0;for(;!t.condition||k(await d(e,t.condition));){if(n++,n>e.maxIterations)throw new L(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",I(e.output));if(e.loopContinue=!1,await F(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;t.update&&await d(e,t.update)}}async function Lt(e,t){let n=e.arrays[t.array];if(n)for(let i of Object.keys(n)){if(e.vars[t.variable]=i,e.loopContinue=!1,await F(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Mt(e,t){if(t.type==="array_access"){let n=S(await d(e,t.key));ge(e,t.array,n)}else t.type==="variable"&&we(e,t.name)}var H=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}execute(t){this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await x(this.ctx,t.action.statements),this.ctx.shouldExit))break}}async executeLine(t){if(!(!this.program||this.ctx.shouldExit)){G(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let i=this.program.rules[n];i.pattern?.type==="begin"||i.pattern?.type==="end"||await this.matchesRule(i,n)&&await x(this.ctx,i.action.statements)}}}async executeEnd(){if(this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await x(this.ctx,t.action.statements),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){let i=t.pattern;if(!i)return!0;switch(i.type){case"begin":case"end":return!1;case"regex_pattern":return U(i.pattern,this.ctx.line);case"expr_pattern":return k(await d(this.ctx,i.expression));case"range":{let s=await this.matchPattern(i.start),a=await this.matchPattern(i.end);return this.rangeStates[n]?(a&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,a&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(t.type){case"regex_pattern":return U(t.pattern,this.ctx.line);case"expr_pattern":return k(await d(this.ctx,t.expression));default:return!1}}};var r;(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(r||(r={}));var Pt=new Map([["BEGIN",r.BEGIN],["END",r.END],["if",r.IF],["else",r.ELSE],["while",r.WHILE],["do",r.DO],["for",r.FOR],["in",r.IN],["break",r.BREAK],["continue",r.CONTINUE],["next",r.NEXT],["nextfile",r.NEXTFILE],["exit",r.EXIT],["return",r.RETURN],["delete",r.DELETE],["function",r.FUNCTION],["print",r.PRINT],["printf",r.PRINTF],["getline",r.GETLINE]]);function Tt(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var Q=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(r.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
|
|
8
|
+
`?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
|
|
9
|
+
`)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
10
|
+
`;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,i=this.peek();return i===`
|
|
11
|
+
`?(this.advance(),{type:r.NEWLINE,value:`
|
|
12
|
+
`,line:t,column:n}):i==='"'?this.readString():i==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(i)||i==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(i)||i==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,r.NEWLINE,r.SEMICOLON,r.LBRACE,r.RBRACE,r.LPAREN,r.LBRACKET,r.COMMA,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.AND,r.OR,r.NOT,r.MATCH,r.NOT_MATCH,r.QUESTION,r.COLON,r.LT,r.GT,r.LE,r.GE,r.EQ,r.NE,r.PLUS,r.MINUS,r.STAR,r.PERCENT,r.CARET,r.PRINT,r.PRINTF,r.IF,r.WHILE,r.DO,r.FOR,r.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":i+=`
|
|
13
|
+
`;break;case"t":i+=" ";break;case"r":i+="\r";break;case"f":i+="\f";break;case"b":i+="\b";break;case"v":i+="\v";break;case"a":i+="\x07";break;case"\\":i+="\\";break;case'"':i+='"';break;case"/":i+="/";break;case"x":{let a="";for(;a.length<2&&/[0-9a-fA-F]/.test(this.peek());)a+=this.advance();a.length>0?i+=String.fromCharCode(parseInt(a,16)):i+="x";break}default:if(/[0-7]/.test(s)){let a=s;for(;a.length<3&&/[0-7]/.test(this.peek());)a+=this.advance();i+=String.fromCharCode(parseInt(a,8))}else i+=s}}else i+=this.advance();return this.peek()==='"'&&this.advance(),{type:r.STRING,value:i,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let i="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")i+=this.advance(),this.pos<this.input.length&&(i+=this.advance());else{if(this.peek()===`
|
|
14
|
+
`)break;i+=this.advance()}return this.peek()==="/"&&this.advance(),i=Tt(i),{type:r.REGEX,value:i,line:t,column:n}}readNumber(){let t=this.line,n=this.column,i="";for(;this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(i+=this.advance();this.isDigit(this.peek());)i+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(i+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(i+=this.advance());this.isDigit(this.peek());)i+=this.advance();return{type:r.NUMBER,value:parseFloat(i),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,i="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)i+=this.advance();let s=Pt.get(i);return s!==void 0?{type:s,value:i,line:t,column:n}:{type:r.IDENT,value:i,line:t,column:n}}readOperator(){let t=this.line,n=this.column,i=this.advance(),s=this.peek();switch(i){case"+":return s==="+"?(this.advance(),{type:r.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:r.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:r.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:r.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:r.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:r.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:r.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:r.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:r.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:r.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:r.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:r.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:r.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:r.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:r.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:r.EQ,value:"==",line:t,column:n}):{type:r.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:r.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:r.NOT_MATCH,value:"!~",line:t,column:n}):{type:r.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:r.LE,value:"<=",line:t,column:n}):{type:r.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:r.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:r.APPEND,value:">>",line:t,column:n}):{type:r.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:r.AND,value:"&&",line:t,column:n}):{type:r.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:r.OR,value:"||",line:t,column:n}):{type:r.PIPE,value:"|",line:t,column:n};case"~":return{type:r.MATCH,value:"~",line:t,column:n};case"?":return{type:r.QUESTION,value:"?",line:t,column:n};case":":return{type:r.COLON,value:":",line:t,column:n};case",":return{type:r.COMMA,value:",",line:t,column:n};case";":return{type:r.SEMICOLON,value:";",line:t,column:n};case"(":return{type:r.LPAREN,value:"(",line:t,column:n};case")":return{type:r.RPAREN,value:")",line:t,column:n};case"{":return{type:r.LBRACE,value:"{",line:t,column:n};case"}":return{type:r.RBRACE,value:"}",line:t,column:n};case"[":return{type:r.LBRACKET,value:"[",line:t,column:n};case"]":return{type:r.RBRACKET,value:"]",line:t,column:n};case"$":return{type:r.DOLLAR,value:"$",line:t,column:n};default:return{type:r.IDENT,value:i,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}};var u={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"};function Le(e){e.expect(u.PRINT);let t=[];if(e.check(u.NEWLINE)||e.check(u.SEMICOLON)||e.check(u.RBRACE)||e.check(u.PIPE)||e.check(u.GT)||e.check(u.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(q(e));e.check(u.COMMA);)e.advance(),t.push(q(e));let n;return e.check(u.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(u.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function q(e){return Ft(e)?ae(e,!0):ae(e,!1)}function ae(e,t){let n=t?e.parseTernary():_t(e);if(e.match(u.ASSIGN,u.PLUS_ASSIGN,u.MINUS_ASSIGN,u.STAR_ASSIGN,u.SLASH_ASSIGN,u.PERCENT_ASSIGN,u.CARET_ASSIGN)){let i=e.advance(),s=ae(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(i.value)??"=",target:n,value:s}}return n}function Ft(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let i=e.tokens[n];if(i.type===u.LPAREN&&t++,i.type===u.RPAREN&&t--,i.type===u.QUESTION&&t===0)return!0;if(i.type===u.NEWLINE||i.type===u.SEMICOLON||i.type===u.RBRACE||i.type===u.COMMA||i.type===u.PIPE)return!1;n++}return!1}function _t(e){let t=ke(e);for(;e.check(u.OR);){e.advance();let n=ke(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function ke(e){let t=Ce(e);for(;e.check(u.AND);){e.advance();let n=Ce(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function Ce(e){let t=Gt(e);if(e.check(u.IN)){e.advance();let n=String(e.expect(u.IDENT).value);return{type:"in",key:t,array:n}}return t}function Gt(e){let t=Oe(e);for(;Dt(e)&&!xt(e);){let n=Oe(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function Oe(e){let t=be(e);for(;e.match(u.MATCH,u.NOT_MATCH);){let n=e.advance().type===u.MATCH?"~":"!~",i=be(e);t={type:"binary",operator:n,left:t,right:i}}return t}function be(e){let t=e.parseAddSub();for(;e.match(u.LT,u.LE,u.GE,u.EQ,u.NE);){let n=e.advance(),i=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}function Dt(e){return e.match(u.NUMBER,u.STRING,u.IDENT,u.DOLLAR,u.LPAREN,u.NOT,u.MINUS,u.PLUS,u.INCREMENT,u.DECREMENT)}function xt(e){return e.match(u.AND,u.OR,u.QUESTION,u.ASSIGN,u.PLUS_ASSIGN,u.MINUS_ASSIGN,u.STAR_ASSIGN,u.SLASH_ASSIGN,u.PERCENT_ASSIGN,u.CARET_ASSIGN,u.COMMA,u.SEMICOLON,u.NEWLINE,u.RBRACE,u.RPAREN,u.RBRACKET,u.COLON,u.PIPE,u.APPEND,u.GT,u.IN)}function Me(e){e.expect(u.PRINTF);let t=e.check(u.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():q(e),i=[];for(;e.check(u.COMMA);)e.advance(),t&&e.skipNewlines(),i.push(t?e.parseExpression():q(e));t&&(e.skipNewlines(),e.expect(u.RPAREN));let s;return e.check(u.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(u.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:i,output:s}}var J=class{tokens=[];pos=0;parse(t){let n=new Q(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:r.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let i=this.current();throw new Error(n||`Expected ${t}, got ${i.type} at line ${i.line}:${i.column}`)}return this.advance()}skipNewlines(){for(;this.check(r.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(r.NEWLINE)||this.check(r.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(r.EOF)&&(this.skipNewlines(),!this.check(r.EOF));)this.check(r.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(r.FUNCTION);let t=this.expect(r.IDENT).value;this.expect(r.LPAREN);let n=[];if(!this.check(r.RPAREN))for(n.push(this.expect(r.IDENT).value);this.check(r.COMMA);)this.advance(),n.push(this.expect(r.IDENT).value);this.expect(r.RPAREN),this.skipNewlines();let i=this.parseBlock();return{name:t,params:n,body:i}}parseRule(){let t;if(this.check(r.BEGIN))this.advance(),t={type:"begin"};else if(this.check(r.END))this.advance(),t={type:"end"};else if(this.check(r.LBRACE))t=void 0;else if(this.check(r.REGEX)){let i=this.advance();if(this.check(r.AND)||this.check(r.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:i.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:i.value};if(this.check(r.COMMA)){this.advance();let a;this.check(r.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(r.COMMA)){this.advance();let a;this.check(r.REGEX)?a={type:"regex_pattern",pattern:this.advance().value}:a={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:a}}else t=s}this.skipNewlines();let n;return this.check(r.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(r.LBRACE),this.skipNewlines();let t=[];for(;!this.check(r.RBRACE)&&!this.check(r.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(r.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(r.SEMICOLON)||this.check(r.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(r.LBRACE))return this.parseBlock();if(this.check(r.IF))return this.parseIf();if(this.check(r.WHILE))return this.parseWhile();if(this.check(r.DO))return this.parseDoWhile();if(this.check(r.FOR))return this.parseFor();if(this.check(r.BREAK))return this.advance(),{type:"break"};if(this.check(r.CONTINUE))return this.advance(),{type:"continue"};if(this.check(r.NEXT))return this.advance(),{type:"next"};if(this.check(r.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(r.EXIT)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(r.RETURN)){this.advance();let n;return!this.check(r.NEWLINE)&&!this.check(r.SEMICOLON)&&!this.check(r.RBRACE)&&!this.check(r.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(r.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(r.PRINT)?Le(this):this.check(r.PRINTF)?Me(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(r.IF),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let i;return this.check(r.ELSE)&&(this.advance(),this.skipNewlines(),i=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:i}}parseWhile(){this.expect(r.WHILE),this.expect(r.LPAREN);let t=this.parseExpression();this.expect(r.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(r.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(r.WHILE),this.expect(r.LPAREN);let n=this.parseExpression();return this.expect(r.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(r.FOR),this.expect(r.LPAREN),this.check(r.IDENT)){let a=this.advance();if(this.check(r.IN)){this.advance();let o=this.expect(r.IDENT).value;this.expect(r.RPAREN),this.skipNewlines();let c=this.parseStatement();return{type:"for_in",variable:a.value,array:o,body:c}}this.pos--}let t;this.check(r.SEMICOLON)||(t=this.parseExpression()),this.expect(r.SEMICOLON);let n;this.check(r.SEMICOLON)||(n=this.parseExpression()),this.expect(r.SEMICOLON);let i;this.check(r.RPAREN)||(i=this.parseExpression()),this.expect(r.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:i,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN)){let n=this.advance(),i=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:{"=":"=","+=":"+=","-=":"-=","*=":"*=","/=":"/=","%=":"%=","^=":"^="}[n.value],target:t,value:i}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(r.QUESTION)){this.advance();let n=this.parseExpression();this.expect(r.COLON);let i=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:i}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(r.PIPE)){if(this.advance(),!this.check(r.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(r.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(r.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(r.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(r.IN)){this.advance();let n=this.expect(r.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(r.MATCH,r.NOT_MATCH);){let n=this.advance().type===r.MATCH?"~":"!~",i=this.parseComparison();t={type:"binary",operator:n,left:t,right:i}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(r.LT,r.LE,r.GT,r.GE,r.EQ,r.NE);){let n=this.advance(),i=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:i}}return t}canStartExpression(){return this.match(r.NUMBER,r.STRING,r.IDENT,r.DOLLAR,r.LPAREN,r.NOT,r.MINUS,r.PLUS,r.INCREMENT,r.DECREMENT)}isConcatTerminator(){return this.match(r.AND,r.OR,r.QUESTION,r.ASSIGN,r.PLUS_ASSIGN,r.MINUS_ASSIGN,r.STAR_ASSIGN,r.SLASH_ASSIGN,r.PERCENT_ASSIGN,r.CARET_ASSIGN,r.COMMA,r.SEMICOLON,r.NEWLINE,r.RBRACE,r.RPAREN,r.RBRACKET,r.COLON,r.PIPE,r.APPEND,r.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(r.PLUS,r.MINUS);){let n=this.advance().value,i=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:i}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(r.STAR,r.SLASH,r.PERCENT);){let n=this.advance(),i=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:i}}return t}parseUnary(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(r.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(r.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(r.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(r.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(r.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(r.NOT,r.MINUS,r.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(r.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(r.RPAREN),t}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(r.COMMA)){let i=[n];for(;this.check(r.COMMA);)this.advance(),i.push(this.parseExpression());this.expect(r.RBRACKET);let s=i.reduce((a,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:a,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(r.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(r.NUMBER))return{type:"number",value:this.advance().value};if(this.check(r.STRING))return{type:"string",value:this.advance().value};if(this.check(r.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(r.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(r.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(r.COMMA)){let n=[t];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(r.RPAREN),{type:"tuple",elements:n}}return this.expect(r.RPAREN),t}if(this.check(r.GETLINE)){this.advance();let t,n;return this.check(r.IDENT)&&(t=this.advance().value),this.check(r.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(r.IDENT)){let t=this.advance().value;if(this.check(r.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(r.RPAREN))for(n.push(this.parseExpression());this.check(r.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(r.RPAREN),{type:"call",name:t,args:n}}if(this.check(r.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(r.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(r.RBRACKET);let i;if(n.length===1)i=n[0];else{i=n[0];for(let s=1;s<n.length;s++)i={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:i}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}};var Ut={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},Gn={name:"awk",async execute(e,t){let n=ce(e);if(ue(n))return le(Ut);let i=new _(/\s+/),s=" ",a=Object.create(null),o=0;for(let h=0;h<n.length;h++){let p=n[h];if(p==="-F"&&h+1<n.length)s=oe(n[++h]),i=Pe(s),o=h+1;else if(p.startsWith("-F"))s=oe(p.slice(2)),i=Pe(s),o=h+1;else if(p==="-v"&&h+1<n.length){let f=n[++h],R=f.indexOf("=");if(R>0){let O=f.slice(0,R),Fe=oe(f.slice(R+1));a[O]=Fe}o=h+1}else{if(p.startsWith("--"))return Z("awk",p);if(p.startsWith("-")&&p.length>1){let f=p[1];if(f!=="F"&&f!=="v")return Z("awk",`-${f}`);o=h+1}else if(!p.startsWith("-")){o=h;break}}}if(o>=n.length)return{stdout:P,stderr:I(`awk: missing program
|
|
15
|
+
`),exitCode:1};let c=n[o],l=n.slice(o+1),N=new J,w;try{w=N.parse(c)}catch(h){let p=h instanceof Error?h.message:String(h);return{stdout:P,stderr:I(`awk: ${p}
|
|
16
|
+
`),exitCode:1}}let M={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(h,p)=>{try{let f=await t.fs.readFile(h);await t.fs.writeFile(h,f+p)}catch{await t.fs.writeFile(h,p)}},resolvePath:t.fs.resolvePath.bind(t.fs)},y=Y({fieldSep:i,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:M,cwd:t.cwd,exec:t.exec?async h=>{let p=await t.exec(h,{cwd:t.cwd});return{stdout:$(p.stdout),stderr:$(p.stderr),exitCode:p.exitCode}}:void 0,coverage:t.coverage});y.FS=s,y.vars=Object.assign(Object.create(null),a),y.ARGC=l.length+1,y.ARGV=Object.create(null),y.ARGV[0]="awk";for(let h=0;h<l.length;h++)y.ARGV[String(h+1)]=l[h];y.ENVIRON=he(t.env);let C=new H(y);C.execute(w);let g=w.rules.some(h=>h.pattern?.type!=="begin"&&h.pattern?.type!=="end"),E=w.rules.some(h=>h.pattern?.type==="end");try{if(await C.executeBegin(),y.shouldExit)return await C.executeEnd(),{stdout:I(C.getOutput()),stderr:P,exitCode:C.getExitCode()};if(!g&&!E)return{stdout:I(C.getOutput()),stderr:P,exitCode:C.getExitCode()};let h=[];if(l.length>0)for(let p of l)try{let f=t.fs.resolvePath(t.cwd,p),O=(await t.fs.readFile(f)).split(`
|
|
17
|
+
`);O.length>0&&O[O.length-1]===""&&O.pop(),h.push({filename:p,lines:O})}catch{return{stdout:P,stderr:I(`awk: ${p}: No such file or directory
|
|
18
|
+
`),exitCode:1}}else{let p=$(t.stdin).split(`
|
|
19
|
+
`);p.length>0&&p[p.length-1]===""&&p.pop(),h.push({filename:"",lines:p})}for(let p of h){for(y.FILENAME=p.filename,y.FNR=0,y.lines=p.lines,y.lineIndex=-1,y.shouldNextFile=!1;y.lineIndex<p.lines.length-1&&(y.lineIndex++,await C.executeLine(p.lines[y.lineIndex]),!(y.shouldExit||y.shouldNextFile)););if(y.shouldExit)break}return await C.executeEnd(),{stdout:I(C.getOutput()),stderr:P,exitCode:C.getExitCode()}}catch(h){let p=h instanceof Error?h.message:String(h),f=h instanceof L?L.EXIT_CODE:2;return{stdout:I(C.getOutput()),stderr:I(`awk: ${p}
|
|
20
|
+
`),exitCode:f}}}};function oe(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
|
|
21
|
+
`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Pe(e){if(e===" ")return A("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return A(e)}catch{return A(Te(e))}return A(Te(e))}function Te(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Dn={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{Gn as a,Dn as b};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as m,b as p}from"./chunk-227L3ACM.js";import{g as i,h as l,l as u}from"./chunk-RQSPCXDR.js";var b={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},P={name:"readlink",async execute(k,r){let a=u(k);if(p(a))return m(b);let o=!1,t=0;for(;t<a.length&&a[t].startsWith("-");){let n=a[t];if(n==="-f"||n==="--canonicalize")o=!0,t++;else if(n==="--"){t++;break}else return{stdout:i,stderr:l(`readlink: invalid option -- '${n.slice(1)}'
|
|
3
|
+
`),exitCode:1}}let c=a.slice(t);if(c.length===0)return{stdout:i,stderr:l(`readlink: missing operand
|
|
4
|
+
`),exitCode:1};let s="",g=!1;for(let n of c){let d=r.fs.resolvePath(r.cwd,n);try{if(o){let e=d,h=new Set;for(;!h.has(e);){h.add(e);try{let f=await r.fs.readlink(e);if(f.startsWith("/"))e=f;else{let y=e.substring(0,e.lastIndexOf("/"))||"/";e=r.fs.resolvePath(y,f)}}catch{break}}s+=`${e}
|
|
5
|
+
`}else{let e=await r.fs.readlink(d);s+=`${e}
|
|
6
|
+
`}}catch{o?s+=`${d}
|
|
7
|
+
`:g=!0}}return{stdout:l(s),stderr:i,exitCode:g?1:0}}},x={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0};export{P as a,x as b};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{d as S}from"./chunk-UYBH3FNE.js";import{a as P}from"./chunk-4VDEBYW7.js";import{a as O,b as E,c as h}from"./chunk-227L3ACM.js";import{g as f,h as u,l as w}from"./chunk-RQSPCXDR.js";function p(i){let t=i.indexOf("=");if(t>=0){let s=i.slice(0,t),e=i.slice(t+1);return s?`${encodeURIComponent(s)}=${encodeURIComponent(e)}`:encodeURIComponent(e)}return encodeURIComponent(i)}function T(i){let t=i.indexOf("=");if(t<0)return null;let s=i.slice(0,t),e=i.slice(t+1),r,o,n=e.match(/;type=([^;]+)$/);n&&(o=n[1],e=e.slice(0,-n[0].length));let a=e.match(/;filename=([^;]+)/);return a&&(r=a[1],e=e.replace(a[0],"")),(e.startsWith("@")||e.startsWith("<"))&&(r=r??e.slice(1).split("/").pop()),{name:s,value:e,filename:r,contentType:o}}function v(i,t){let s=`----CurlFormBoundary${Date.now().toString(36)}`,e=[];for(let r of i){let o=r.value;if(o.startsWith("@")||o.startsWith("<")){let a=o.slice(1);o=t.get(a)??""}let n=`--${s}\r
|
|
3
|
+
`;r.filename?(n+=`Content-Disposition: form-data; name="${r.name}"; filename="${r.filename}"\r
|
|
4
|
+
`,r.contentType&&(n+=`Content-Type: ${r.contentType}\r
|
|
5
|
+
`)):n+=`Content-Disposition: form-data; name="${r.name}"\r
|
|
6
|
+
`,n+=`\r
|
|
7
|
+
${o}\r
|
|
8
|
+
`,e.push(n)}return e.push(`--${s}--\r
|
|
9
|
+
`),{body:e.join(""),boundary:s}}var F={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data"," --data-urlencode DATA URL-encode and POST data","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]};function W(i){let t={method:"GET",headers:Object.create(null),dataBinary:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1};for(let s=0;s<i.length;s++){let e=i[s];if(e==="-X"||e==="--request")t.method=i[++s]??"GET";else if(e.startsWith("-X"))t.method=e.slice(2);else if(e.startsWith("--request="))t.method=e.slice(10);else if(e==="-H"||e==="--header"){let r=i[++s];if(r){let o=r.indexOf(":");if(o>0){let n=r.slice(0,o).trim(),a=r.slice(o+1).trim();t.headers[n]=a}}}else if(e.startsWith("--header=")){let r=e.slice(9),o=r.indexOf(":");if(o>0){let n=r.slice(0,o).trim(),a=r.slice(o+1).trim();t.headers[n]=a}}else if(e==="-d"||e==="--data"||e==="--data-raw")t.data=i[++s]??"",t.method==="GET"&&(t.method="POST");else if(e.startsWith("-d"))t.data=e.slice(2),t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data="))t.data=e.slice(7),t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data-raw="))t.data=e.slice(11),t.method==="GET"&&(t.method="POST");else if(e==="--data-binary")t.data=i[++s]??"",t.dataBinary=!0,t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data-binary="))t.data=e.slice(14),t.dataBinary=!0,t.method==="GET"&&(t.method="POST");else if(e==="--data-urlencode"){let r=i[++s]??"";t.data=(t.data?`${t.data}&`:"")+p(r),t.method==="GET"&&(t.method="POST")}else if(e.startsWith("--data-urlencode=")){let r=e.slice(17);t.data=(t.data?`${t.data}&`:"")+p(r),t.method==="GET"&&(t.method="POST")}else if(e==="-F"||e==="--form"){let r=i[++s]??"",o=T(r);o&&t.formFields.push(o),t.method==="GET"&&(t.method="POST")}else if(e.startsWith("--form=")){let r=e.slice(7),o=T(r);o&&t.formFields.push(o),t.method==="GET"&&(t.method="POST")}else if(e==="-u"||e==="--user")t.user=i[++s];else if(e.startsWith("-u"))t.user=e.slice(2);else if(e.startsWith("--user="))t.user=e.slice(7);else if(e==="-A"||e==="--user-agent")t.headers["User-Agent"]=i[++s]??"";else if(e.startsWith("-A"))t.headers["User-Agent"]=e.slice(2);else if(e.startsWith("--user-agent="))t.headers["User-Agent"]=e.slice(13);else if(e==="-e"||e==="--referer")t.headers.Referer=i[++s]??"";else if(e.startsWith("-e"))t.headers.Referer=e.slice(2);else if(e.startsWith("--referer="))t.headers.Referer=e.slice(10);else if(e==="-b"||e==="--cookie")t.headers.Cookie=i[++s]??"";else if(e.startsWith("-b"))t.headers.Cookie=e.slice(2);else if(e.startsWith("--cookie="))t.headers.Cookie=e.slice(9);else if(e==="-c"||e==="--cookie-jar")t.cookieJar=i[++s];else if(e.startsWith("--cookie-jar="))t.cookieJar=e.slice(13);else if(e==="-T"||e==="--upload-file")t.uploadFile=i[++s],t.method==="GET"&&(t.method="PUT");else if(e.startsWith("--upload-file="))t.uploadFile=e.slice(14),t.method==="GET"&&(t.method="PUT");else if(e==="-m"||e==="--max-time"){let r=parseFloat(i[++s]??"0");!Number.isNaN(r)&&r>0&&(t.timeoutMs=r*1e3)}else if(e.startsWith("--max-time=")){let r=parseFloat(e.slice(11));!Number.isNaN(r)&&r>0&&(t.timeoutMs=r*1e3)}else if(e==="--connect-timeout"){let r=parseFloat(i[++s]??"0");!Number.isNaN(r)&&r>0&&t.timeoutMs===void 0&&(t.timeoutMs=r*1e3)}else if(e.startsWith("--connect-timeout=")){let r=parseFloat(e.slice(18));!Number.isNaN(r)&&r>0&&t.timeoutMs===void 0&&(t.timeoutMs=r*1e3)}else if(e==="-o"||e==="--output")t.outputFile=i[++s];else if(e.startsWith("--output="))t.outputFile=e.slice(9);else if(e==="-O"||e==="--remote-name")t.useRemoteName=!0;else if(e==="-I"||e==="--head")t.headOnly=!0,t.method="HEAD";else if(e==="-i"||e==="--include")t.includeHeaders=!0;else if(e==="-s"||e==="--silent")t.silent=!0;else if(e==="-S"||e==="--show-error")t.showError=!0;else if(e==="-f"||e==="--fail")t.failSilently=!0;else if(e==="-L"||e==="--location")t.followRedirects=!0;else if(e==="--max-redirs")s++;else if(!e.startsWith("--max-redirs="))if(e==="-w"||e==="--write-out")t.writeOut=i[++s];else if(e.startsWith("--write-out="))t.writeOut=e.slice(12);else if(e==="-v"||e==="--verbose")t.verbose=!0;else{if(e.startsWith("--")&&e!=="--")return h("curl",e);if(e.startsWith("-")&&e!=="-")for(let r of e.slice(1))switch(r){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD";break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;default:return h("curl",`-${r}`)}else e.startsWith("-")||(t.url=e)}}return t}function y(i){return Object.entries(i).map(([t,s])=>`${t}: ${s}`).join(`\r
|
|
10
|
+
`)}function $(i){try{return new URL(i).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function b(i,t){let s=i;return s=s.replace(/%\{http_code\}/g,String(t.status)),s=s.replace(/%\{content_type\}/g,t.headers["content-type"]||""),s=s.replace(/%\{url_effective\}/g,t.url),s=s.replace(/%\{size_download\}/g,String(t.bodyLength)),s=s.replace(/\\n/g,`
|
|
11
|
+
`),s}async function R(i,t){if(i.uploadFile){let s=t.fs.resolvePath(t.cwd,i.uploadFile);return{body:await t.fs.readFile(s)}}if(i.formFields.length>0){let s=new Map;for(let o of i.formFields)if(o.value.startsWith("@")||o.value.startsWith("<")){let n=t.fs.resolvePath(t.cwd,o.value.slice(1));try{let a=await t.fs.readFile(n);s.set(o.value.slice(1),a)}catch{s.set(o.value.slice(1),"")}}let{body:e,boundary:r}=v(i.formFields,s);return{body:e,contentType:`multipart/form-data; boundary=${r}`}}return i.data!==void 0?{body:i.data}:{}}function H(i,t){let s=S(i.headers??{});if(i.user){let e=Buffer.from(i.user).toString("base64");s.Authorization=`Basic ${e}`}return t&&!s["Content-Type"]&&(s["Content-Type"]=t),s}async function x(i,t,s){if(!i.cookieJar)return;let e=t["set-cookie"];if(!e)return;let r=s.fs.resolvePath(s.cwd,i.cookieJar);await s.fs.writeFile(r,e)}function A(i,t,s){let e="";if(i.verbose){e+=`> ${i.method} ${s}
|
|
12
|
+
`;for(let[r,o]of Object.entries(i.headers))e+=`> ${r}: ${o}
|
|
13
|
+
`;e+=`>
|
|
14
|
+
`,e+=`< HTTP/1.1 ${t.status} ${t.statusText}
|
|
15
|
+
`;for(let[r,o]of Object.entries(t.headers))e+=`< ${r}: ${o}
|
|
16
|
+
`;e+=`<
|
|
17
|
+
`}return i.includeHeaders&&!i.verbose&&(e+=`HTTP/1.1 ${t.status} ${t.statusText}\r
|
|
18
|
+
`,e+=y(t.headers),e+=`\r
|
|
19
|
+
\r
|
|
20
|
+
`),i.headOnly?i.includeHeaders||i.verbose||(e+=`HTTP/1.1 ${t.status} ${t.statusText}\r
|
|
21
|
+
`,e+=y(t.headers),e+=`\r
|
|
22
|
+
`):e+=t.body,i.writeOut&&(e+=b(i.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.length})),e}var X={name:"curl",async execute(i,t){let s=w(i);if(E(s))return O(F);let e=W(s);if("exitCode"in e)return e;let r=e;if(!r.url)return{stdout:f,stderr:u(`curl: no URL specified
|
|
23
|
+
`),exitCode:2};if(!t.fetch)return{stdout:f,stderr:u(`curl: internal error: fetch not available
|
|
24
|
+
`),exitCode:1};let o=r.url;o.match(/^https?:\/\//)||(o=`https://${o}`);try{let{body:n,contentType:a}=await R(r,t),l=H(r,a),d=await t.fetch(o,{method:r.method,headers:Object.keys(l).length>0?l:void 0,body:n,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await x(r,d.headers,t),r.failSilently&&d.status>=400){let m=r.showError||!r.silent?`curl: (22) The requested URL returned error: ${d.status}
|
|
25
|
+
`:"";return{stdout:f,stderr:u(m),exitCode:22}}let c=A(r,d,o);if(r.outputFile||r.useRemoteName){let m=r.outputFile||$(o),k=t.fs.resolvePath(t.cwd,m);await t.fs.writeFile(k,r.headOnly?"":d.body),r.verbose||(c=""),r.writeOut&&(c=b(r.writeOut,{status:d.status,headers:d.headers,url:d.url,bodyLength:d.body.length}))}return{stdout:u(c),stderr:f,exitCode:0}}catch(n){let a=P(n),l=1;a.includes("Network access denied")?l=7:a.includes("HTTP method")&&a.includes("not allowed")?l=3:a.includes("Redirect target not in allow-list")||a.includes("Too many redirects")?l=47:a.includes("aborted")&&(l=28);let c=!r.silent||r.showError?`curl: (${l}) ${a}
|
|
26
|
+
`:"";return{stdout:f,stderr:u(c),exitCode:l}}}};export{X as curlCommand};
|