just-bash 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/AGENTS.md +4 -2
- package/dist/bin/chunks/{alias-ZAQAKC5X.js → alias-PCMLRCRW.js} +1 -1
- package/dist/bin/chunks/{awk2-A73ZNFXJ.js → awk2-D2US2LMM.js} +1 -1
- package/dist/bin/{shell/chunks/base64-JPITV4MD.js → chunks/base64-RJX7MYGG.js} +1 -1
- package/dist/bin/{shell/chunks/basename-IYEP3AMY.js → chunks/basename-SO5MVUEX.js} +1 -1
- package/dist/bin/chunks/{bash-WZYHIZP6.js → bash-UT3MT5UU.js} +1 -1
- package/dist/bin/{shell/chunks/cat-XILYL7NW.js → chunks/cat-7TVSOZLU.js} +1 -1
- package/dist/bin/{shell/chunks/chmod-EXWX4N7Y.js → chunks/chmod-3DIKREF7.js} +1 -1
- package/dist/bin/chunks/{chunk-WEONT2KP.js → chunk-ACRTDIBO.js} +1 -1
- package/dist/bin/chunks/chunk-KGOUQS5A.js +2 -0
- package/dist/bin/chunks/chunk-OQRRF62X.js +10 -0
- package/dist/bin/chunks/chunk-QSDVMMYI.js +21 -0
- package/dist/bin/chunks/{clear-2APRIRCF.js → clear-CI7A5IXQ.js} +1 -1
- package/dist/bin/chunks/column-TSFEMTG6.js +8 -0
- package/dist/bin/chunks/{comm-KY3COLF5.js → comm-CPIFQTKY.js} +1 -1
- package/dist/bin/{shell/chunks/cp-HES4UN7K.js → chunks/cp-XXWRVG2D.js} +1 -1
- package/dist/bin/chunks/{curl-BN5M3BUX.js → curl-LCMREE7R.js} +1 -1
- package/dist/bin/chunks/{cut-JSIPAKOX.js → cut-VCKWLT2T.js} +1 -1
- package/dist/bin/chunks/{date-CU4J7GHI.js → date-IQLPMFYI.js} +1 -1
- package/dist/bin/{shell/chunks/diff-W4JRNHXW.js → chunks/diff-GI3QVUGD.js} +1 -1
- package/dist/bin/chunks/{dirname-UTCUUILN.js → dirname-EES7TR26.js} +1 -1
- package/dist/bin/chunks/{du-2JU3PUTM.js → du-ZONJJZUK.js} +1 -1
- package/dist/bin/{shell/chunks/echo-HKLPYMNC.js → chunks/echo-WSKTON6U.js} +1 -1
- package/dist/bin/chunks/{env-2SBJNP7X.js → env-YLLSNZZN.js} +1 -1
- package/dist/bin/chunks/expand-77K5HH2M.js +11 -0
- package/dist/bin/chunks/{expr-M74QZQ6C.js → expr-RMGXYNQJ.js} +1 -1
- package/dist/bin/{shell/chunks/file-QPD3U2H7.js → chunks/file-XMPFXMUJ.js} +1 -1
- package/dist/bin/{shell/chunks/find-TRBVCSI6.js → chunks/find-P6UQXFKX.js} +1 -1
- package/dist/bin/chunks/fold-452R4I2C.js +12 -0
- package/dist/bin/{shell/chunks/grep-BEZRXAWL.js → chunks/grep-L5HBHEEQ.js} +1 -1
- package/dist/bin/chunks/{gzip-VLTXZB2V.js → gzip-MNCJB6OR.js} +1 -1
- package/dist/bin/chunks/{head-YGMY3DHE.js → head-DYK37Z24.js} +1 -1
- package/dist/bin/chunks/{help-UEF7LW7F.js → help-7C5JICNL.js} +1 -1
- package/dist/bin/{shell/chunks/history-OGBCIAR5.js → chunks/history-G5C2J2OY.js} +1 -1
- package/dist/bin/chunks/{hostname-CV7CGKRN.js → hostname-WXDKRL2Z.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-HTGML4TH.js → html-to-markdown-EPEXKI4B.js} +1 -1
- package/dist/bin/chunks/join-3IXMEGNA.js +14 -0
- package/dist/bin/chunks/{jq-DT3MD2GZ.js → jq-MTQKMJJI.js} +1 -1
- package/dist/bin/chunks/{ln-RUR4ALOJ.js → ln-EFFNQ3RY.js} +1 -1
- package/dist/bin/chunks/{ls-GU5227KE.js → ls-FSSC77F4.js} +1 -1
- package/dist/bin/chunks/{md5sum-C7WDEYN5.js → md5sum-VGXAOUBA.js} +1 -1
- package/dist/bin/chunks/{mkdir-4OYU22AA.js → mkdir-XJABRAUN.js} +1 -1
- package/dist/bin/chunks/{mv-H3S4FEWR.js → mv-3ATZ2ABL.js} +1 -1
- package/dist/bin/chunks/nl-DSM3NUGM.js +17 -0
- package/dist/bin/{shell/chunks/od-TXTSFFJY.js → chunks/od-SLM7SRWU.js} +1 -1
- package/dist/bin/chunks/{paste-HHCFASL4.js → paste-FT6WBQZG.js} +1 -1
- package/dist/bin/chunks/{printf-2JFCUFOA.js → printf-HWUQKYUM.js} +1 -1
- package/dist/bin/{shell/chunks/pwd-T5Q3JEBO.js → chunks/pwd-53KG2MCJ.js} +1 -1
- package/dist/bin/chunks/{readlink-M44TLMFS.js → readlink-VL3R4LAM.js} +1 -1
- package/dist/bin/chunks/rev-VP42N2JN.js +7 -0
- package/dist/bin/chunks/{rm-R4M647EC.js → rm-2PKAWTSQ.js} +1 -1
- package/dist/bin/{shell/chunks/sed-QLLAZYHH.js → chunks/sed-5LQMJYRJ.js} +1 -1
- package/dist/bin/chunks/{seq-GJMQM7SP.js → seq-AVK43XM2.js} +1 -1
- package/dist/bin/chunks/{sha1sum-WKCGV66X.js → sha1sum-BIUH233Z.js} +1 -1
- package/dist/bin/{shell/chunks/sha256sum-3ZDGP5WC.js → chunks/sha256sum-SUIK2MT2.js} +1 -1
- package/dist/bin/chunks/{sleep-OJPODQGM.js → sleep-O5BOTJGJ.js} +1 -1
- package/dist/bin/chunks/{sort-JL33INQB.js → sort-J5ARYV56.js} +1 -1
- package/dist/bin/chunks/split-JJFZRWRC.js +16 -0
- package/dist/bin/chunks/sqlite3-J2DBDCKT.js +36 -0
- package/dist/bin/{shell/chunks/stat-CR2INBC2.js → chunks/stat-UEQ7KMY5.js} +1 -1
- package/dist/bin/chunks/strings-ZEKN6D4Q.js +14 -0
- package/dist/bin/chunks/{tac-F4GC3MAI.js → tac-KNRFDAY7.js} +1 -1
- package/dist/bin/chunks/{tail-BYPLMYMZ.js → tail-BES27CZT.js} +1 -1
- package/dist/bin/chunks/{tee-HOMRRC3X.js → tee-ZFIT2GTM.js} +1 -1
- package/dist/bin/{shell/chunks/timeout-MYKG34DQ.js → chunks/timeout-JED4EKFH.js} +1 -1
- package/dist/bin/{shell/chunks/touch-3ZANYAXI.js → chunks/touch-TSNAXMZ2.js} +1 -1
- package/dist/bin/{shell/chunks/tr-E66N7IS2.js → chunks/tr-MBLEXZBI.js} +1 -1
- package/dist/bin/chunks/{tree-EE2PYIMV.js → tree-ESVATRDW.js} +1 -1
- package/dist/bin/chunks/{true-OWPVS7U4.js → true-OVATH2SQ.js} +1 -1
- package/dist/bin/chunks/unexpand-BFVYAPOU.js +11 -0
- package/dist/bin/chunks/{uniq-F5NP3LLU.js → uniq-7JNZWE5D.js} +1 -1
- package/dist/bin/chunks/{wc-NBMNJDZL.js → wc-OFU3HUEZ.js} +1 -1
- package/dist/bin/chunks/{which-6MRG2UCF.js → which-73KOOLC6.js} +1 -1
- package/dist/bin/chunks/xan-ASGSTJP4.js +140 -0
- package/dist/bin/chunks/xan-view-YGORUYA2.js +2 -0
- package/dist/bin/chunks/{xargs-EMY5BOJ2.js → xargs-WIJC4RTG.js} +1 -1
- package/dist/bin/chunks/yq-MF2SNFGL.js +287 -0
- package/dist/bin/just-bash.js +42 -42
- package/dist/bin/shell/chunks/{alias-ZAQAKC5X.js → alias-PCMLRCRW.js} +1 -1
- package/dist/bin/shell/chunks/{awk2-A73ZNFXJ.js → awk2-D2US2LMM.js} +1 -1
- package/dist/bin/{chunks/base64-JPITV4MD.js → shell/chunks/base64-RJX7MYGG.js} +1 -1
- package/dist/bin/{chunks/basename-IYEP3AMY.js → shell/chunks/basename-SO5MVUEX.js} +1 -1
- package/dist/bin/shell/chunks/{bash-WZYHIZP6.js → bash-UT3MT5UU.js} +1 -1
- package/dist/bin/{chunks/cat-XILYL7NW.js → shell/chunks/cat-7TVSOZLU.js} +1 -1
- package/dist/bin/{chunks/chmod-EXWX4N7Y.js → shell/chunks/chmod-3DIKREF7.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-WEONT2KP.js → chunk-ACRTDIBO.js} +1 -1
- package/dist/bin/shell/chunks/chunk-KGOUQS5A.js +2 -0
- package/dist/bin/shell/chunks/chunk-OQRRF62X.js +10 -0
- package/dist/bin/shell/chunks/chunk-QSDVMMYI.js +21 -0
- package/dist/bin/shell/chunks/{clear-2APRIRCF.js → clear-CI7A5IXQ.js} +1 -1
- package/dist/bin/shell/chunks/column-TSFEMTG6.js +8 -0
- package/dist/bin/shell/chunks/{comm-KY3COLF5.js → comm-CPIFQTKY.js} +1 -1
- package/dist/bin/{chunks/cp-HES4UN7K.js → shell/chunks/cp-XXWRVG2D.js} +1 -1
- package/dist/bin/shell/chunks/{curl-BN5M3BUX.js → curl-LCMREE7R.js} +1 -1
- package/dist/bin/shell/chunks/{cut-JSIPAKOX.js → cut-VCKWLT2T.js} +1 -1
- package/dist/bin/shell/chunks/{date-CU4J7GHI.js → date-IQLPMFYI.js} +1 -1
- package/dist/bin/{chunks/diff-W4JRNHXW.js → shell/chunks/diff-GI3QVUGD.js} +1 -1
- package/dist/bin/shell/chunks/{dirname-UTCUUILN.js → dirname-EES7TR26.js} +1 -1
- package/dist/bin/shell/chunks/{du-2JU3PUTM.js → du-ZONJJZUK.js} +1 -1
- package/dist/bin/{chunks/echo-HKLPYMNC.js → shell/chunks/echo-WSKTON6U.js} +1 -1
- package/dist/bin/shell/chunks/{env-2SBJNP7X.js → env-YLLSNZZN.js} +1 -1
- package/dist/bin/shell/chunks/expand-77K5HH2M.js +11 -0
- package/dist/bin/shell/chunks/{expr-M74QZQ6C.js → expr-RMGXYNQJ.js} +1 -1
- package/dist/bin/{chunks/file-QPD3U2H7.js → shell/chunks/file-XMPFXMUJ.js} +1 -1
- package/dist/bin/{chunks/find-TRBVCSI6.js → shell/chunks/find-P6UQXFKX.js} +1 -1
- package/dist/bin/shell/chunks/fold-452R4I2C.js +12 -0
- package/dist/bin/{chunks/grep-BEZRXAWL.js → shell/chunks/grep-L5HBHEEQ.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-VLTXZB2V.js → gzip-MNCJB6OR.js} +1 -1
- package/dist/bin/shell/chunks/{head-YGMY3DHE.js → head-DYK37Z24.js} +1 -1
- package/dist/bin/shell/chunks/{help-UEF7LW7F.js → help-7C5JICNL.js} +1 -1
- package/dist/bin/{chunks/history-OGBCIAR5.js → shell/chunks/history-G5C2J2OY.js} +1 -1
- package/dist/bin/shell/chunks/{hostname-CV7CGKRN.js → hostname-WXDKRL2Z.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-HTGML4TH.js → html-to-markdown-EPEXKI4B.js} +1 -1
- package/dist/bin/shell/chunks/join-3IXMEGNA.js +14 -0
- package/dist/bin/shell/chunks/{jq-DT3MD2GZ.js → jq-MTQKMJJI.js} +1 -1
- package/dist/bin/shell/chunks/{ln-RUR4ALOJ.js → ln-EFFNQ3RY.js} +1 -1
- package/dist/bin/shell/chunks/{ls-GU5227KE.js → ls-FSSC77F4.js} +1 -1
- package/dist/bin/shell/chunks/{md5sum-C7WDEYN5.js → md5sum-VGXAOUBA.js} +1 -1
- package/dist/bin/shell/chunks/{mkdir-4OYU22AA.js → mkdir-XJABRAUN.js} +1 -1
- package/dist/bin/shell/chunks/{mv-H3S4FEWR.js → mv-3ATZ2ABL.js} +1 -1
- package/dist/bin/shell/chunks/nl-DSM3NUGM.js +17 -0
- package/dist/bin/{chunks/od-TXTSFFJY.js → shell/chunks/od-SLM7SRWU.js} +1 -1
- package/dist/bin/shell/chunks/{paste-HHCFASL4.js → paste-FT6WBQZG.js} +1 -1
- package/dist/bin/shell/chunks/{printf-2JFCUFOA.js → printf-HWUQKYUM.js} +1 -1
- package/dist/bin/{chunks/pwd-T5Q3JEBO.js → shell/chunks/pwd-53KG2MCJ.js} +1 -1
- package/dist/bin/shell/chunks/{readlink-M44TLMFS.js → readlink-VL3R4LAM.js} +1 -1
- package/dist/bin/shell/chunks/rev-VP42N2JN.js +7 -0
- package/dist/bin/shell/chunks/{rm-R4M647EC.js → rm-2PKAWTSQ.js} +1 -1
- package/dist/bin/{chunks/sed-QLLAZYHH.js → shell/chunks/sed-5LQMJYRJ.js} +1 -1
- package/dist/bin/shell/chunks/{seq-GJMQM7SP.js → seq-AVK43XM2.js} +1 -1
- package/dist/bin/shell/chunks/{sha1sum-WKCGV66X.js → sha1sum-BIUH233Z.js} +1 -1
- package/dist/bin/{chunks/sha256sum-3ZDGP5WC.js → shell/chunks/sha256sum-SUIK2MT2.js} +1 -1
- package/dist/bin/shell/chunks/{sleep-OJPODQGM.js → sleep-O5BOTJGJ.js} +1 -1
- package/dist/bin/shell/chunks/{sort-JL33INQB.js → sort-J5ARYV56.js} +1 -1
- package/dist/bin/shell/chunks/split-JJFZRWRC.js +16 -0
- package/dist/bin/shell/chunks/sqlite3-J2DBDCKT.js +36 -0
- package/dist/bin/{chunks/stat-CR2INBC2.js → shell/chunks/stat-UEQ7KMY5.js} +1 -1
- package/dist/bin/shell/chunks/strings-ZEKN6D4Q.js +14 -0
- package/dist/bin/shell/chunks/{tac-F4GC3MAI.js → tac-KNRFDAY7.js} +1 -1
- package/dist/bin/shell/chunks/{tail-BYPLMYMZ.js → tail-BES27CZT.js} +1 -1
- package/dist/bin/shell/chunks/{tee-HOMRRC3X.js → tee-ZFIT2GTM.js} +1 -1
- package/dist/bin/{chunks/timeout-MYKG34DQ.js → shell/chunks/timeout-JED4EKFH.js} +1 -1
- package/dist/bin/{chunks/touch-3ZANYAXI.js → shell/chunks/touch-TSNAXMZ2.js} +1 -1
- package/dist/bin/{chunks/tr-E66N7IS2.js → shell/chunks/tr-MBLEXZBI.js} +1 -1
- package/dist/bin/shell/chunks/{tree-EE2PYIMV.js → tree-ESVATRDW.js} +1 -1
- package/dist/bin/shell/chunks/{true-OWPVS7U4.js → true-OVATH2SQ.js} +1 -1
- package/dist/bin/shell/chunks/unexpand-BFVYAPOU.js +11 -0
- package/dist/bin/shell/chunks/{uniq-F5NP3LLU.js → uniq-7JNZWE5D.js} +1 -1
- package/dist/bin/shell/chunks/{wc-NBMNJDZL.js → wc-OFU3HUEZ.js} +1 -1
- package/dist/bin/shell/chunks/{which-6MRG2UCF.js → which-73KOOLC6.js} +1 -1
- package/dist/bin/shell/chunks/xan-ASGSTJP4.js +140 -0
- package/dist/bin/shell/chunks/xan-view-YGORUYA2.js +2 -0
- package/dist/bin/shell/chunks/{xargs-EMY5BOJ2.js → xargs-WIJC4RTG.js} +1 -1
- package/dist/bin/shell/chunks/yq-MF2SNFGL.js +287 -0
- package/dist/bin/shell/shell.js +66 -66
- package/dist/bundle/browser.js +486 -394
- package/dist/bundle/chunks/{alias-JFIUWFGE.js → alias-4UGRF4DM.js} +1 -1
- package/dist/bundle/chunks/{awk2-QWBT4IFJ.js → awk2-46RTIZKB.js} +1 -1
- package/dist/bundle/chunks/{base64-TUA2XORD.js → base64-F5R4G5EG.js} +1 -1
- package/dist/bundle/chunks/{basename-5UVU5RXR.js → basename-CFA5ZIGT.js} +1 -1
- package/dist/bundle/chunks/{bash-BASUPKHJ.js → bash-ZILV3VHA.js} +1 -1
- package/dist/bundle/chunks/{cat-47EP4IAV.js → cat-CE7XIAD2.js} +1 -1
- package/dist/bundle/chunks/{chmod-XJXFAD4M.js → chmod-FBHLEIY6.js} +1 -1
- package/dist/bundle/chunks/{chunk-OQ2MSNPG.js → chunk-4JO5BKO4.js} +1 -1
- package/dist/bundle/chunks/chunk-DXB73IDG.js +1 -0
- package/dist/bundle/chunks/chunk-SYMJJMQ4.js +20 -0
- package/dist/bundle/chunks/chunk-U4UYWYTO.js +9 -0
- package/dist/bundle/chunks/{clear-XD3TJRVQ.js → clear-VT2LJIDX.js} +1 -1
- package/dist/bundle/chunks/column-XPDNNO5Y.js +7 -0
- package/dist/bundle/chunks/{comm-KSJ4BBRQ.js → comm-AXQM7FFF.js} +1 -1
- package/dist/bundle/chunks/{cp-37OVLNLD.js → cp-PBJT3GBF.js} +1 -1
- package/dist/bundle/chunks/{curl-C43O5WQS.js → curl-TVZH24MD.js} +1 -1
- package/dist/bundle/chunks/{cut-FIZRELKC.js → cut-MCCSW2TZ.js} +1 -1
- package/dist/bundle/chunks/{date-NN5C354M.js → date-PN3CMG7K.js} +1 -1
- package/dist/bundle/chunks/{diff-GLRVCAKJ.js → diff-ZLJYSBRK.js} +1 -1
- package/dist/bundle/chunks/{dirname-U2KVUSQY.js → dirname-YPJLCQYA.js} +1 -1
- package/dist/bundle/chunks/{du-KRAFOIQK.js → du-3NURMGXT.js} +1 -1
- package/dist/bundle/chunks/{echo-WUKBESC7.js → echo-VUHWYV6L.js} +1 -1
- package/dist/bundle/chunks/{env-MSPSPGCD.js → env-EG5SQSAQ.js} +1 -1
- package/dist/bundle/chunks/expand-VSTNOVF5.js +10 -0
- package/dist/bundle/chunks/{expr-HYOCSWK6.js → expr-DG4E7SIS.js} +1 -1
- package/dist/bundle/chunks/{file-LQXX6P4Y.js → file-AWZ3TUFP.js} +1 -1
- package/dist/bundle/chunks/{find-GM7FJ4D3.js → find-QJDJJ5KW.js} +1 -1
- package/dist/bundle/chunks/fold-6CFXIPYZ.js +11 -0
- package/dist/bundle/chunks/{grep-ZJVDG3FA.js → grep-4K5T3MYL.js} +1 -1
- package/dist/bundle/chunks/{gzip-UQS7KRTV.js → gzip-7QAS5P2Y.js} +1 -1
- package/dist/bundle/chunks/{head-6PAUYCDP.js → head-FZ6IQHYW.js} +1 -1
- package/dist/bundle/chunks/{help-5E6PYJWQ.js → help-75YOGKM4.js} +1 -1
- package/dist/bundle/chunks/{history-SG6VRATI.js → history-MQDK2OPD.js} +1 -1
- package/dist/bundle/chunks/{hostname-K4BA3P6X.js → hostname-NWR32CGF.js} +1 -1
- package/dist/bundle/chunks/{html-to-markdown-ZSZ34PAN.js → html-to-markdown-ZK6GQVSL.js} +1 -1
- package/dist/bundle/chunks/join-X3QYPZUA.js +13 -0
- package/dist/bundle/chunks/{jq-NZZAXGBX.js → jq-QAA4WF2O.js} +1 -1
- package/dist/bundle/chunks/{ln-XFYHBIFL.js → ln-Y7YB677N.js} +1 -1
- package/dist/bundle/chunks/{ls-JGYJQA2Y.js → ls-CS3TIKWR.js} +1 -1
- package/dist/bundle/chunks/{md5sum-PIH6F3O3.js → md5sum-LJHKXLVT.js} +1 -1
- package/dist/bundle/chunks/{mkdir-HA2FJX4O.js → mkdir-7UKY4B3B.js} +1 -1
- package/dist/bundle/chunks/{mv-7I62SB3I.js → mv-FXHEKRTB.js} +1 -1
- package/dist/bundle/chunks/nl-KWQGFZH5.js +16 -0
- package/dist/bundle/chunks/{od-SOCTFI2F.js → od-ECWXNUB4.js} +1 -1
- package/dist/bundle/chunks/{paste-QBGVCQFT.js → paste-QTGVEPH5.js} +1 -1
- package/dist/bundle/chunks/{printf-HBP44PXI.js → printf-VG2POOXB.js} +1 -1
- package/dist/bundle/chunks/{pwd-CEF235GL.js → pwd-AC4P3JKI.js} +1 -1
- package/dist/bundle/chunks/{readlink-MQIMKDSA.js → readlink-EM4O3U4P.js} +1 -1
- package/dist/bundle/chunks/rev-FKUV5GH5.js +6 -0
- package/dist/bundle/chunks/{rm-NF3FNLAY.js → rm-I2SRVF7H.js} +1 -1
- package/dist/bundle/chunks/{sed-H2RWPMTM.js → sed-ZKODWZ6F.js} +1 -1
- package/dist/bundle/chunks/{seq-VKYIUOPJ.js → seq-5VRIVQYP.js} +1 -1
- package/dist/bundle/chunks/{sha1sum-HVHNZSEC.js → sha1sum-NRUZZ4Q6.js} +1 -1
- package/dist/bundle/chunks/{sha256sum-REOOJORK.js → sha256sum-5ZGJ4NJL.js} +1 -1
- package/dist/bundle/chunks/{sleep-AFN3PHJW.js → sleep-AK4QE4WR.js} +1 -1
- package/dist/bundle/chunks/{sort-XODGFZC4.js → sort-PMLMEZ4E.js} +1 -1
- package/dist/bundle/chunks/split-YBTFW7MT.js +15 -0
- package/dist/bundle/chunks/sqlite3-RCPUSN3E.js +35 -0
- package/dist/bundle/chunks/{stat-FVFLDQGP.js → stat-IVQBBOKN.js} +1 -1
- package/dist/bundle/chunks/strings-LRU5XCFP.js +13 -0
- package/dist/bundle/chunks/{tac-VIFKNLII.js → tac-2X4JLF4W.js} +1 -1
- package/dist/bundle/chunks/{tail-QXKYHAML.js → tail-PD4RZR6J.js} +1 -1
- package/dist/bundle/chunks/{tee-W5HCCBPO.js → tee-2QU4NRSJ.js} +1 -1
- package/dist/bundle/chunks/{timeout-XAA3N7CF.js → timeout-X3X3N6IE.js} +1 -1
- package/dist/bundle/chunks/{touch-FOE745V2.js → touch-MVQSKQKT.js} +1 -1
- package/dist/bundle/chunks/{tr-LMLGE4IE.js → tr-EDGW5FG6.js} +1 -1
- package/dist/bundle/chunks/{tree-WBUGLVP5.js → tree-5TYW7S7K.js} +1 -1
- package/dist/bundle/chunks/{true-6LGCG4EY.js → true-CNJ54NE6.js} +1 -1
- package/dist/bundle/chunks/unexpand-I7A2VXFD.js +10 -0
- package/dist/bundle/chunks/{uniq-7PFWPNWK.js → uniq-ONGDGSEB.js} +1 -1
- package/dist/bundle/chunks/{wc-GV5WUREX.js → wc-Y5MNUNQQ.js} +1 -1
- package/dist/bundle/chunks/{which-KHFYPBWW.js → which-M5MQ6QXQ.js} +1 -1
- package/dist/bundle/chunks/xan-B3RI2BDO.js +139 -0
- package/dist/bundle/chunks/xan-view-33AU6NPN.js +1 -0
- package/dist/bundle/chunks/{xargs-NQBNFMCT.js → xargs-2IMBHM4N.js} +1 -1
- package/dist/bundle/chunks/yq-KANM4MD2.js +286 -0
- package/dist/bundle/index.js +27 -27
- package/dist/commands/column/column.d.ts +9 -0
- package/dist/commands/expand/expand.d.ts +10 -0
- package/dist/commands/expand/unexpand.d.ts +10 -0
- package/dist/commands/fold/fold.d.ts +10 -0
- package/dist/commands/join/join.d.ts +10 -0
- package/dist/commands/nl/nl.d.ts +10 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/rev/rev.d.ts +11 -0
- package/dist/commands/split/split.d.ts +10 -0
- package/dist/commands/sqlite3/formatters.d.ts +15 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +8 -0
- package/dist/commands/strings/strings.d.ts +10 -0
- package/dist/commands/xan/aggregation.d.ts +20 -0
- package/dist/commands/xan/csv.d.ts +16 -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/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-utils.d.ts +19 -0
- package/dist/commands/xan/xan-view.d.ts +12 -0
- package/dist/commands/xan/xan.d.ts +8 -0
- package/package.json +3 -1
- package/dist/bin/chunks/chunk-SJXDWN5X.js +0 -2
- package/dist/bin/chunks/yq-XRJR6BNP.js +0 -304
- package/dist/bin/shell/chunks/chunk-SJXDWN5X.js +0 -2
- package/dist/bin/shell/chunks/yq-XRJR6BNP.js +0 -304
- package/dist/bundle/chunks/chunk-2RUN43TJ.js +0 -1
- package/dist/bundle/chunks/yq-63LJU3AR.js +0 -303
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{a as z,b as W}from"./chunk-74CEPOFO.js";import{a as m,c as p,e as Le}from"./chunk-DXB73IDG.js";var y=p(_=>{"use strict";_.getBooleanOption=(e,t)=>{let r=!1;if(t in e&&typeof(r=e[t])!="boolean")throw new TypeError(`Expected the "${t}" option to be a boolean`);return r};_.cppdb=Symbol();_.inspect=Symbol.for("nodejs.util.inspect.custom")});var k=p((St,H)=>{"use strict";var B={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function x(e,t){if(new.target!==x)return new x(e,t);if(typeof t!="string")throw new TypeError("Expected second argument to be a string");Error.call(this,e),B.value=""+e,Object.defineProperty(this,"message",B),Error.captureStackTrace(this,x),this.code=t}Object.setPrototypeOf(x,Error);Object.setPrototypeOf(x.prototype,Error.prototype);Object.defineProperty(x.prototype,"name",B);H.exports=x});var J=p((qt,Q)=>{var v=m("path").sep||"/";Q.exports=Re;function Re(e){if(typeof e!="string"||e.length<=7||e.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),r=t.indexOf("/"),n=t.substring(0,r),i=t.substring(r+1);return n=="localhost"&&(n=""),n&&(n=v+v+n),i=i.replace(/^(.+)\|/,"$1:"),v=="\\"&&(i=i.replace(/\//g,"\\")),/^.+\:/.test(i)||(i=v+i),n+i}});var Y=p((O,X)=>{var M=m("fs"),L=m("path"),Ve=J(),C=L.join,Ae=L.dirname,G=M.accessSync&&function(e){try{M.accessSync(e)}catch{return!1}return!0}||M.existsSync||L.existsSync,K={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function De(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(K).map(function(l){l in e||(e[l]=K[l])}),e.module_root||(e.module_root=O.getRoot(O.getFileName())),L.extname(e.bindings)!=".node"&&(e.bindings+=".node");for(var t=typeof __webpack_require__=="function"?__non_webpack_require__:m,r=[],n=0,i=e.try.length,o,s,a;n<i;n++){o=C.apply(null,e.try[n].map(function(l){return e[l]||l})),r.push(o);try{return s=e.path?t.resolve(o):t(o),e.path||(s.path=o),s}catch(l){if(l.code!=="MODULE_NOT_FOUND"&&l.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(l.message))throw l}}throw a=new Error(`Could not locate the bindings file. Tried:
|
|
2
|
+
`+r.map(function(l){return e.arrow+l}).join(`
|
|
3
|
+
`)),a.tries=r,a}X.exports=O=De;O.getFileName=function(t){var r=Error.prepareStackTrace,n=Error.stackTraceLimit,i={},o;Error.stackTraceLimit=10,Error.prepareStackTrace=function(a,l){for(var u=0,f=l.length;u<f;u++)if(o=l[u].getFileName(),o!==__filename)if(t){if(o!==t)return}else return},Error.captureStackTrace(i),i.stack,Error.prepareStackTrace=r,Error.stackTraceLimit=n;var s="file://";return o.indexOf(s)===0&&(o=Ve(o)),o};O.getRoot=function(t){for(var r=Ae(t),n;;){if(r==="."&&(r=process.cwd()),G(C(r,"package.json"))||G(C(r,"node_modules")))return r;if(n===r)throw new Error('Could not find module root given file: "'+t+'". Do you have a `package.json` file? ');n=r,r=C(r,"..")}}});var Z=p(E=>{"use strict";var{cppdb:b}=y();E.prepare=function(t){return this[b].prepare(t,this,!1)};E.exec=function(t){return this[b].exec(t),this};E.close=function(){return this[b].close(),this};E.loadExtension=function(...t){return this[b].loadExtension(...t),this};E.defaultSafeIntegers=function(...t){return this[b].defaultSafeIntegers(...t),this};E.unsafeMode=function(...t){return this[b].unsafeMode(...t),this};E.getters={name:{get:function(){return this[b].name},enumerable:!0},open:{get:function(){return this[b].open},enumerable:!0},inTransaction:{get:function(){return this[b].inTransaction},enumerable:!0},readonly:{get:function(){return this[b].readonly},enumerable:!0},memory:{get:function(){return this[b].memory},enumerable:!0}}});var re=p((vt,te)=>{"use strict";var{cppdb:Pe}=y(),ee=new WeakMap;te.exports=function(t){if(typeof t!="function")throw new TypeError("Expected first argument to be a function");let r=this[Pe],n=Be(r,this),{apply:i}=Function.prototype,o={default:{value:R(i,t,r,n.default)},deferred:{value:R(i,t,r,n.deferred)},immediate:{value:R(i,t,r,n.immediate)},exclusive:{value:R(i,t,r,n.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(o.default.value,o),Object.defineProperties(o.deferred.value,o),Object.defineProperties(o.immediate.value,o),Object.defineProperties(o.exclusive.value,o),o.default.value};var Be=(e,t)=>{let r=ee.get(e);if(!r){let n={commit:e.prepare("COMMIT",t,!1),rollback:e.prepare("ROLLBACK",t,!1),savepoint:e.prepare("SAVEPOINT ` _bs3. `",t,!1),release:e.prepare("RELEASE ` _bs3. `",t,!1),rollbackTo:e.prepare("ROLLBACK TO ` _bs3. `",t,!1)};ee.set(e,r={default:Object.assign({begin:e.prepare("BEGIN",t,!1)},n),deferred:Object.assign({begin:e.prepare("BEGIN DEFERRED",t,!1)},n),immediate:Object.assign({begin:e.prepare("BEGIN IMMEDIATE",t,!1)},n),exclusive:Object.assign({begin:e.prepare("BEGIN EXCLUSIVE",t,!1)},n)})}return r},R=(e,t,r,{begin:n,commit:i,rollback:o,savepoint:s,release:a,rollbackTo:l})=>function(){let f,d,g;r.inTransaction?(f=s,d=a,g=l):(f=n,d=i,g=o),f.run();try{let w=e.call(t,this,arguments);if(w&&typeof w.then=="function")throw new TypeError("Transaction function cannot return a promise");return d.run(),w}catch(w){throw r.inTransaction&&(g.run(),g!==o&&d.run()),w}}});var oe=p((Ct,ne)=>{"use strict";var{getBooleanOption:ke,cppdb:Me}=y();ne.exports=function(t,r){if(r==null&&(r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");let n=ke(r,"simple"),i=this[Me].prepare(`PRAGMA ${t}`,this,!0);return n?i.pluck().get():i.all()}});var se=p((Lt,ae)=>{"use strict";var Fe=m("fs"),Ne=m("path"),{promisify:Ue}=m("util"),{cppdb:ze}=y(),ie=Ue(Fe.access);ae.exports=async function(t,r){if(r==null&&(r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");t=t.trim();let n="attached"in r?r.attached:"main",i="progress"in r?r.progress:null;if(!t)throw new TypeError("Backup filename cannot be an empty string");if(t===":memory:")throw new TypeError('Invalid backup filename ":memory:"');if(typeof n!="string")throw new TypeError('Expected the "attached" option to be a string');if(!n)throw new TypeError('The "attached" option cannot be an empty string');if(i!=null&&typeof i!="function")throw new TypeError('Expected the "progress" option to be a function');await ie(Ne.dirname(t)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let o=await ie(t).then(()=>!1,()=>!0);return We(this[ze].backup(this,n,t,o),i||null)};var We=(e,t)=>{let r=0,n=!0;return new Promise((i,o)=>{setImmediate(function s(){try{let a=e.transfer(r);if(!a.remainingPages){e.close(),i(a);return}if(n&&(n=!1,r=100),t){let l=t(a);if(l!==void 0)if(typeof l=="number"&&l===l)r=Math.max(0,Math.min(2147483647,Math.round(l)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(s)}catch(a){e.close(),o(a)}})})}});var ue=p((Rt,le)=>{"use strict";var{cppdb:He}=y();le.exports=function(t){if(t==null&&(t={}),typeof t!="object")throw new TypeError("Expected first argument to be an options object");let r="attached"in t?t.attached:"main";if(typeof r!="string")throw new TypeError('Expected the "attached" option to be a string');if(!r)throw new TypeError('The "attached" option cannot be an empty string');return this[He].serialize(r)}});var ce=p((Vt,fe)=>{"use strict";var{getBooleanOption:V,cppdb:Qe}=y();fe.exports=function(t,r,n){if(r==null&&(r={}),typeof r=="function"&&(n=r,r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof n!="function")throw new TypeError("Expected last argument to be a function");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let i="safeIntegers"in r?+V(r,"safeIntegers"):2,o=V(r,"deterministic"),s=V(r,"directOnly"),a=V(r,"varargs"),l=-1;if(!a){if(l=n.length,!Number.isInteger(l)||l<0)throw new TypeError("Expected function.length to be a positive integer");if(l>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[Qe].function(n,t,l,i,o,s),this}});var he=p((At,de)=>{"use strict";var{getBooleanOption:A,cppdb:Je}=y();de.exports=function(t,r){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object"||r===null)throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let n="start"in r?r.start:null,i=F(r,"step",!0),o=F(r,"inverse",!1),s=F(r,"result",!1),a="safeIntegers"in r?+A(r,"safeIntegers"):2,l=A(r,"deterministic"),u=A(r,"directOnly"),f=A(r,"varargs"),d=-1;if(!f&&(d=Math.max(pe(i),o?pe(o):0),d>0&&(d-=1),d>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[Je].aggregate(n,i,o,s,t,d,a,l,u),this};var F=(e,t,r)=>{let n=t in e?e[t]:null;if(typeof n=="function")return n;if(n!=null)throw new TypeError(`Expected the "${t}" option to be a function`);if(r)throw new TypeError(`Missing required option "${t}"`);return null},pe=({length:e})=>{if(Number.isInteger(e)&&e>=0)return e;throw new TypeError("Expected function.length to be a positive integer")}});var ye=p((Dt,be)=>{"use strict";var{cppdb:Ge}=y();be.exports=function(t,r){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(!t)throw new TypeError("Virtual table module name cannot be an empty string");let n=!1;if(typeof r=="object"&&r!==null)n=!0,r=nt(ge(r,"used",t));else{if(typeof r!="function")throw new TypeError("Expected second argument to be a function or a table definition object");r=Ke(r)}return this[Ge].table(r,t,n),this};function Ke(e){return function(r,n,i,...o){let s={module:r,database:n,table:i},a=tt.call(e,s,o);if(typeof a!="object"||a===null)throw new TypeError(`Virtual table module "${r}" did not return a table definition object`);return ge(a,"returned",r)}}function ge(e,t,r){if(!S.call(e,"rows"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "rows" property`);if(!S.call(e,"columns"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "columns" property`);let n=e.rows;if(typeof n!="function"||Object.getPrototypeOf(n)!==rt)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "rows" property (should be a generator function)`);let i=e.columns;if(!Array.isArray(i)||!(i=[...i]).every(u=>typeof u=="string"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "columns" property (should be an array of strings)`);if(i.length!==new Set(i).size)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate column names`);if(!i.length)throw new RangeError(`Virtual table module "${r}" ${t} a table definition with zero columns`);let o;if(S.call(e,"parameters")){if(o=e.parameters,!Array.isArray(o)||!(o=[...o]).every(u=>typeof u=="string"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "parameters" property (should be an array of strings)`)}else o=et(n);if(o.length!==new Set(o).size)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate parameter names`);if(o.length>32)throw new RangeError(`Virtual table module "${r}" ${t} a table definition with more than the maximum number of 32 parameters`);for(let u of o)if(i.includes(u))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with column "${u}" which was ambiguously defined as both a column and parameter`);let s=2;if(S.call(e,"safeIntegers")){let u=e.safeIntegers;if(typeof u!="boolean")throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "safeIntegers" property (should be a boolean)`);s=+u}let a=!1;if(S.call(e,"directOnly")&&(a=e.directOnly,typeof a!="boolean"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "directOnly" property (should be a boolean)`);return[`CREATE TABLE x(${[...o.map(me).map(u=>`${u} HIDDEN`),...i.map(me)].join(", ")});`,Xe(n,new Map(i.map((u,f)=>[u,o.length+f])),r),o,s,a]}function Xe(e,t,r){return function*(...i){let o=i.map(s=>Buffer.isBuffer(s)?Buffer.from(s):s);for(let s=0;s<t.size;++s)o.push(null);for(let s of e(...i))if(Array.isArray(s))Ye(s,o,t.size,r),yield o;else if(typeof s=="object"&&s!==null)Ze(s,o,t,r),yield o;else throw new TypeError(`Virtual table module "${r}" yielded something that isn't a valid row object`)}}function Ye(e,t,r,n){if(e.length!==r)throw new TypeError(`Virtual table module "${n}" yielded a row with an incorrect number of columns`);let i=t.length-r;for(let o=0;o<r;++o)t[o+i]=e[o]}function Ze(e,t,r,n){let i=0;for(let o of Object.keys(e)){let s=r.get(o);if(s===void 0)throw new TypeError(`Virtual table module "${n}" yielded a row with an undeclared column "${o}"`);t[s]=e[o],i+=1}if(i!==r.size)throw new TypeError(`Virtual table module "${n}" yielded a row with missing columns`)}function et({length:e}){if(!Number.isInteger(e)||e<0)throw new TypeError("Expected function.length to be a positive integer");let t=[];for(let r=0;r<e;++r)t.push(`$${r+1}`);return t}var{hasOwnProperty:S}=Object.prototype,{apply:tt}=Function.prototype,rt=Object.getPrototypeOf(function*(){}),me=e=>`"${e.replace(/"/g,'""')}"`,nt=e=>()=>e});var Ee=p((Pt,we)=>{"use strict";var ot=function(){};we.exports=function(t,r){return Object.assign(new ot,this)}});var $e=p((Bt,je)=>{"use strict";var it=m("fs"),Te=m("path"),D=y(),at=k(),xe;function c(e,t){if(new.target==null)return new c(e,t);let r;if(Buffer.isBuffer(e)&&(r=e,e=":memory:"),e==null&&(e=""),t==null&&(t={}),typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in t)throw new TypeError('Misspelled option "readOnly" should be "readonly"');if("memory"in t)throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');let n=e.trim(),i=n===""||n===":memory:",o=D.getBooleanOption(t,"readonly"),s=D.getBooleanOption(t,"fileMustExist"),a="timeout"in t?t.timeout:5e3,l="verbose"in t?t.verbose:null,u="nativeBinding"in t?t.nativeBinding:null;if(o&&i&&!r)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(a)||a<0)throw new TypeError('Expected the "timeout" option to be a positive integer');if(a>2147483647)throw new RangeError('Option "timeout" cannot be greater than 2147483647');if(l!=null&&typeof l!="function")throw new TypeError('Expected the "verbose" option to be a function');if(u!=null&&typeof u!="string"&&typeof u!="object")throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');let f;if(u==null?f=xe||(xe=Y()("better_sqlite3.node")):typeof u=="string"?f=(typeof __non_webpack_require__=="function"?__non_webpack_require__:m)(Te.resolve(u).replace(/(\.node)?$/,".node")):f=u,f.isInitialized||(f.setErrorConstructor(at),f.isInitialized=!0),!i&&!it.existsSync(Te.dirname(n)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[D.cppdb]:{value:new f.Database(n,e,i,o,s,a,l||null,r||null)},...j.getters})}var j=Z();c.prototype.prepare=j.prepare;c.prototype.transaction=re();c.prototype.pragma=oe();c.prototype.backup=se();c.prototype.serialize=ue();c.prototype.function=ce();c.prototype.aggregate=he();c.prototype.table=ye();c.prototype.loadExtension=j.loadExtension;c.prototype.exec=j.exec;c.prototype.close=j.close;c.prototype.defaultSafeIntegers=j.defaultSafeIntegers;c.prototype.unsafeMode=j.unsafeMode;c.prototype[D.inspect]=Ee();je.exports=c});var Oe=p((Mt,N)=>{"use strict";N.exports=$e();N.exports.SqliteError=k()});var q=Le(Oe(),1);function Ie(e,t,r){switch(r.mode){case"list":return st(e,t,r);case"csv":return lt(e,t,r);case"json":return ft(e,t);case"line":return ct(e,t,r);case"column":return pt(e,t,r);case"table":return dt(e,t,r);case"markdown":return ht(e,t,r);case"tabs":return mt(e,t,r);case"box":return gt(e,t,r);case"quote":return bt(e,t,r);case"html":return yt(e,t,r);case"ascii":return wt(e,t,r)}}function h(e,t){return e==null?t:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function st(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(r.separator));for(let i of t)n.push(i.map(o=>h(o,r.nullValue)).join(r.separator));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function lt(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(Se).join(","));for(let i of t)n.push(i.map(o=>Se(h(o,r.nullValue))).join(","));return n.length>0?`${n.join(`
|
|
4
|
+
`)}
|
|
5
|
+
`:""}function Se(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
|
|
6
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function _e(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function ut(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):_e(e):JSON.stringify(e)}function ft(e,t){return t.length===0?"":`[${t.map(n=>`{${e.map((o,s)=>`${JSON.stringify(o)}:${ut(n[s])}`).join(",")}}`).join(`,
|
|
7
|
+
`)}]
|
|
8
|
+
`}function ct(e,t,r){if(e.length===0||t.length===0)return"";let n=Math.max(5,...e.map(o=>o.length)),i=[];for(let o of t)for(let s=0;s<e.length;s++){let a=e[s].padStart(n);i.push(`${a} = ${h(o[s],r.nullValue)}`)}return`${i.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`}function pt(e,t,r){if(e.length===0)return"";let n=e.map(o=>o.length);for(let o of t)for(let s=0;s<o.length;s++){let a=h(o[s],r.nullValue).length;a>n[s]&&(n[s]=a)}let i=[];r.header&&(i.push(e.map((o,s)=>o.padEnd(n[s])).join(" ")),i.push(n.map(o=>"-".repeat(o)).join(" ")));for(let o of t)i.push(o.map((s,a)=>h(s,r.nullValue).padEnd(n[a])).join(" "));return i.length>0?`${i.join(`
|
|
11
|
+
`)}
|
|
12
|
+
`:""}function dt(e,t,r){if(e.length===0)return"";let n=e.map(s=>s.length);for(let s of t)for(let a=0;a<s.length;a++){let l=h(s[a],r.nullValue).length;l>n[a]&&(n[a]=l)}let i=[],o=`+${n.map(s=>"-".repeat(s+2)).join("+")}+`;i.push(o),r.header&&(i.push(`| ${e.map((s,a)=>s.padEnd(n[a])).join(" | ")} |`),i.push(o));for(let s of t)i.push(`| ${s.map((a,l)=>h(a,r.nullValue).padEnd(n[l])).join(" | ")} |`);return i.push(o),`${i.join(`
|
|
13
|
+
`)}
|
|
14
|
+
`}function ht(e,t,r){if(e.length===0)return"";let n=[];r.header&&(n.push(`| ${e.join(" | ")} |`),n.push(`|${e.map(()=>"---").join("|")}|`));for(let i of t)n.push(`| ${i.map(o=>h(o,r.nullValue)).join(" | ")} |`);return n.length>0?`${n.join(`
|
|
15
|
+
`)}
|
|
16
|
+
`:""}function mt(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(" "));for(let i of t)n.push(i.map(o=>h(o,r.nullValue)).join(" "));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function gt(e,t,r){if(e.length===0)return"";let n=e.map(o=>o.length);for(let o of t)for(let s=0;s<o.length;s++){let a=h(o[s],r.nullValue).length;a>n[s]&&(n[s]=a)}let i=[];i.push(`\u250C${n.map(o=>"\u2500".repeat(o+2)).join("\u252C")}\u2510`),i.push(`\u2502 ${e.map((o,s)=>o.padEnd(n[s])).join(" \u2502 ")} \u2502`),i.push(`\u251C${n.map(o=>"\u2500".repeat(o+2)).join("\u253C")}\u2524`);for(let o of t)i.push(`\u2502 ${o.map((s,a)=>h(s,r.nullValue).padEnd(n[a])).join(" \u2502 ")} \u2502`);return i.push(`\u2514${n.map(o=>"\u2500".repeat(o+2)).join("\u2534")}\u2518`),`${i.join(`
|
|
17
|
+
`)}
|
|
18
|
+
`}function bt(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(i=>`'${i}'`).join(","));for(let i of t)n.push(i.map(o=>o==null?"NULL":typeof o=="number"?Number.isInteger(o)?String(o):_e(o):`'${String(o)}'`).join(","));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function yt(e,t,r){let n=[];r.header&&e.length>0&&(n.push(`<TR>${e.map(i=>`<TH>${qe(i)}</TH>`).join("")}`),n.push("</TR>"));for(let i of t)n.push(`<TR>${i.map(o=>`<TD>${qe(h(o,r.nullValue))}</TD>`).join("")}`),n.push("</TR>");return n.length>0?`${n.join(`
|
|
19
|
+
`)}
|
|
20
|
+
`:""}function qe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wt(e,t,r){let o=[];r.header&&e.length>0&&o.push(e.join(""));for(let s of t)o.push(s.map(a=>h(a,r.nullValue)).join(""));return o.length>0?o.join("")+"":""}var Et={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function Tt(e){let t={mode:"list",header:!1,separator:"|",newline:`
|
|
21
|
+
`,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},r=null,n=null,i=!1,o=!1;for(let s=0;s<e.length;s++){let a=e[s];if(o){r===null?r=a:n===null&&(n=a);continue}if(a==="--")o=!0;else if(a==="-version")i=!0;else if(a==="-list")t.mode="list";else if(a==="-csv")t.mode="csv";else if(a==="-json")t.mode="json";else if(a==="-line")t.mode="line";else if(a==="-column")t.mode="column";else if(a==="-table")t.mode="table";else if(a==="-markdown")t.mode="markdown";else if(a==="-tabs")t.mode="tabs";else if(a==="-box")t.mode="box";else if(a==="-quote")t.mode="quote";else if(a==="-html")t.mode="html";else if(a==="-ascii")t.mode="ascii";else if(a==="-header")t.header=!0;else if(a==="-noheader")t.header=!1;else if(a==="-readonly")t.readonly=!0;else if(a==="-bail")t.bail=!0;else if(a==="-echo")t.echo=!0;else if(a==="-separator"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
|
|
22
|
+
`,exitCode:1};t.separator=e[++s]}else if(a==="-newline"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
|
|
23
|
+
`,exitCode:1};t.newline=e[++s]}else if(a==="-nullvalue"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
|
|
24
|
+
`,exitCode:1};t.nullValue=e[++s]}else if(a==="-cmd"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
|
|
25
|
+
`,exitCode:1};t.cmd=e[++s]}else{if(a.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${a.startsWith("--")?a.slice(1):a}
|
|
26
|
+
Use -help for a list of options.
|
|
27
|
+
`,exitCode:1};r===null?r=a:n===null&&(n=a)}}return{options:t,database:r,sql:n,showVersion:i}}function xt(e){let t=e.trim().toUpperCase();return t.startsWith("INSERT")||t.startsWith("UPDATE")||t.startsWith("DELETE")||t.startsWith("CREATE")||t.startsWith("DROP")||t.startsWith("ALTER")||t.startsWith("REPLACE")}function jt(e){let t=[],r="",n=!1,i="";for(let s=0;s<e.length;s++){let a=e[s];if(n)r+=a,a===i&&(e[s+1]===i?r+=e[++s]:n=!1);else if(a==="'"||a==='"')r+=a,n=!0,i=a;else if(a===";"){let l=r.trim();l&&t.push(l),r=""}else r+=a}let o=r.trim();return o&&t.push(o),t}function $t(){let e=new q.default(":memory:");try{return e.prepare("SELECT sqlite_version()").get()["sqlite_version()"]}finally{e.close()}}var zt={name:"sqlite3",async execute(e,t){if(W(e)||e.includes("-help"))return z(Et);let r=Tt(e);if("exitCode"in r)return r;let{options:n,database:i,sql:o,showVersion:s}=r;if(s)return{stdout:`${$t()}
|
|
28
|
+
`,stderr:"",exitCode:0};if(!i)return{stdout:"",stderr:`sqlite3: missing database argument
|
|
29
|
+
`,exitCode:1};let a=o||t.stdin.trim();if(n.cmd&&(a=n.cmd+(a?`; ${a}`:"")),!a)return{stdout:"",stderr:`sqlite3: no SQL provided
|
|
30
|
+
`,exitCode:1};let l,u=i===":memory:",f="";try{if(u)l=new q.default(":memory:");else if(f=t.fs.resolvePath(t.cwd,i),await t.fs.exists(f)){let $=await t.fs.readFileBuffer(f);l=new q.default(Buffer.from($))}else l=new q.default(":memory:")}catch($){return{stdout:"",stderr:`sqlite3: unable to open database "${i}": ${$.message}
|
|
31
|
+
`,exitCode:1}}let d={mode:n.mode,header:n.header,separator:n.separator,newline:n.newline,nullValue:n.nullValue},g="",w=!1;n.echo&&(g+=`${a}
|
|
32
|
+
`);try{let $=jt(a);for(let T of $)try{if(xt(T))l.exec(T),w=!0;else{let I=l.prepare(T),ve=I.columns().map(Ce=>Ce.name),U=I.raw(!0).all();(U.length>0||n.header)&&(g+=Ie(ve,U,d))}}catch(I){let P=I.message;if(n.bail)return{stdout:g,stderr:`Error: ${P}
|
|
33
|
+
`,exitCode:1};g+=`Error: ${P}
|
|
34
|
+
`}if(w&&!n.readonly&&!u&&f)try{let T=l.serialize();await t.fs.writeFile(f,T)}catch(T){return{stdout:g,stderr:`sqlite3: failed to write database: ${T.message}
|
|
35
|
+
`,exitCode:1}}return{stdout:g,stderr:"",exitCode:0}}finally{l.close()}}};export{zt as sqlite3Command};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-ZVV5VXYZ.js";import{a as u,b as g}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-ZVV5VXYZ.js";import{a as u,b as g}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var S={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"]},$={format:{short:"c",type:"string"}},x={name:"stat",async execute(e,a){if(g(e))return u(S);let s=d("stat",e,$);if(!s.ok)return s.error;let n=s.result.flags.format??null,c=s.result.positional;if(c.length===0)return{stdout:"",stderr:`stat: missing operand
|
|
2
2
|
`,exitCode:1};let o="",p="",f=!1;for(let i of c){let h=a.fs.resolvePath(a.cwd,i);try{let r=await a.fs.stat(h);if(n){let t=n,l=r.mode.toString(8),y=m(r.mode,r.isDirectory);t=t.replace(/%n/g,i),t=t.replace(/%N/g,`'${i}'`),t=t.replace(/%s/g,String(r.size)),t=t.replace(/%F/g,r.isDirectory?"directory":"regular file"),t=t.replace(/%a/g,l),t=t.replace(/%A/g,y),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}
|
|
3
3
|
`}else{let t=r.mode.toString(8).padStart(4,"0"),l=m(r.mode,r.isDirectory);o+=` File: ${i}
|
|
4
4
|
`,o+=` Size: ${r.size} Blocks: ${Math.ceil(r.size/512)}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as c,b as f,c as d}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var m={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};function p(n){return n>=32&&n<=126||n===9}function u(n,s){if(s===null)return"";switch(s){case"o":return`${n.toString(8).padStart(7," ")} `;case"x":return`${n.toString(16).padStart(7," ")} `;case"d":return`${n.toString(10).padStart(7," ")} `;default:return s}}function h(n,s){let o=[],r="",i=0,l=typeof n=="string"?new TextEncoder().encode(n):n;for(let e=0;e<l.length;e++){let t=l[e];if(p(t))r.length===0&&(i=e),r+=String.fromCharCode(t);else{if(r.length>=s.minLength){let a=u(i,s.offsetFormat);o.push(`${a}${r}`)}r=""}}if(r.length>=s.minLength){let e=u(i,s.offsetFormat);o.push(`${e}${r}`)}return o}var N={name:"strings",execute:async(n,s)=>{if(f(n))return c(m);let o={minLength:4,offsetFormat:null},r=[],i=0;for(;i<n.length;){let e=n[i];if(e==="-n"&&i+1<n.length){let t=Number.parseInt(n[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${n[i+1]}'
|
|
2
|
+
`};o.minLength=t,i+=2}else if(e.match(/^-n\d+$/)){let t=Number.parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e.slice(2)}'
|
|
3
|
+
`};o.minLength=t,i++}else if(e.match(/^-\d+$/)){let t=Number.parseInt(e.slice(1),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e.slice(1)}'
|
|
4
|
+
`};o.minLength=t,i++}else if(e==="-t"&&i+1<n.length){let t=n[i+1];if(t!=="o"&&t!=="x"&&t!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${t}'
|
|
5
|
+
`};o.offsetFormat=t,i+=2}else if(e.startsWith("-t")&&e.length===3){let t=e[2];if(t!=="o"&&t!=="x"&&t!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${t}'
|
|
6
|
+
`};o.offsetFormat=t,i++}else if(e==="-a"||e==="--all"||e==="-")e==="-"&&r.push(e),i++;else if(e==="-e"&&i+1<n.length){let t=n[i+1];if(t!=="s"&&t!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${t}'
|
|
7
|
+
`};i+=2}else if(e.startsWith("-e")&&e.length===3){let t=e[2];if(t!=="s"&&t!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${t}'
|
|
8
|
+
`};i++}else if(e==="--"){r.push(...n.slice(i+1));break}else{if(e.startsWith("-")&&e!=="-")return d("strings",e);r.push(e),i++}}let l="";if(r.length===0){let e=s.stdin??"",t=h(e,o);l=t.length>0?`${t.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`:""}else for(let e of r){let t;if(e==="-")t=s.stdin??"";else{let g=s.fs.resolvePath(s.cwd,e);if(t=await s.fs.readFile(g),t===null)return{exitCode:1,stdout:l,stderr:`strings: ${e}: No such file or directory
|
|
11
|
+
`}}let a=h(t,o);a.length>0&&(l+=`${a.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`)}return{exitCode:0,stdout:l,stderr:""}}};export{N as strings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-DXB73IDG.js";async function i(t,o){if(t.length>0&&t[0]!=="-"){let c=t[0].startsWith("/")?t[0]:`${o.cwd}/${t[0]}`;try{let n=(await o.fs.readFile(c)).split(`
|
|
2
2
|
`);n[n.length-1]===""&&n.pop();let s=n.reverse();return{stdout:s.length>0?`${s.join(`
|
|
3
3
|
`)}
|
|
4
4
|
`:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${t[0]}: No such file or directory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as n,d as l}from"./chunk-W2EKKAIL.js";import{a as i,b as s}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a,b as n,d as l}from"./chunk-W2EKKAIL.js";import{a as i,b as s}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var h={name:"tail",summary:"output the last part of files",usage:"tail [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the last NUM bytes","-n, --lines=NUM print the last NUM lines (default 10)","-n +NUM print starting from line NUM","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},c={name:"tail",async execute(t,r){if(s(t))return i(h);let e=a(t,"tail");if(!e.ok)return e.error;let{lines:o,bytes:p,fromLine:m}=e.options;return n(r,e.options,"tail",f=>l(f,o,p,m??!1))}};export{c as tailCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-ZVV5VXYZ.js";import{a as p,b as l}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-ZVV5VXYZ.js";import{a as p,b as l}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var h={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},m={append:{short:"a",long:"append",type:"boolean"}},g={name:"tee",async execute(r,e){if(l(r))return p(h);let t=d("tee",r,m);if(!t.ok)return t.error;let{append:f}=t.result.flags,c=t.result.positional,o=e.stdin,n="",a=0;for(let i of c)try{let s=e.fs.resolvePath(e.cwd,i);f?await e.fs.appendFile(s,o):await e.fs.writeFile(s,o)}catch{n+=`tee: ${i}: No such file or directory
|
|
2
2
|
`,a=1}return{stdout:o,stderr:n,exitCode:a}}};export{g as teeCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c,b as f,c as u}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as c,b as f,c as u}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var x={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
|
|
2
2
|
|
|
3
3
|
DURATION is a number with optional suffix:
|
|
4
4
|
s - seconds (default)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as f}from"./chunk-44UOCSGV.js";import{c as r}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-44UOCSGV.js";import{c as r}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var l={name:"touch",async execute(u,e){let s=[];for(let t of u){if(t.startsWith("--"))return r("touch",t);if(t.startsWith("-")&&t.length>1)return r("touch",t);s.push(t)}if(s.length===0)return{stdout:"",stderr:`touch: missing file operand
|
|
2
2
|
`,exitCode:1};let n="",i=0;for(let t of s)try{let o=e.fs.resolvePath(e.cwd,t);await e.fs.exists(o)||await e.fs.writeFile(o,"")}catch(o){n+=`touch: cannot touch '${t}': ${f(o)}
|
|
3
3
|
`,i=1}return{stdout:"",stderr:n,exitCode:i}}};export{l as touchCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as C}from"./chunk-ZVV5VXYZ.js";import{a as g,b as m}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-ZVV5VXYZ.js";import{a as g,b as m}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var x={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
|
|
2
2
|
a-z character range
|
|
3
3
|
[:alnum:] all letters and digits
|
|
4
4
|
[:alpha:] all letters
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as P}from"./chunk-ZVV5VXYZ.js";import{a as $,b as w}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as P}from"./chunk-ZVV5VXYZ.js";import{a as $,b as w}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var g={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},O={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},N={name:"tree",async execute(s,o){if(w(s))return $(g);let e=P("tree",s,O);if(!e.ok)return e.error;let u={showHidden:e.result.flags.showHidden,directoriesOnly:e.result.flags.directoriesOnly,maxDepth:e.result.flags.maxDepth??null,fullPath:e.result.flags.fullPath},a=e.result.positional;a.length===0&&a.push(".");let t="",c="",l=0,r=0;for(let i of a){let n=await b(o,i,u,"",0);t+=n.output,c+=n.stderr,l+=n.dirCount,r+=n.fileCount}return t+=`
|
|
2
2
|
${l} director${l===1?"y":"ies"}`,u.directoriesOnly||(t+=`, ${r} file${r===1?"":"s"}`),t+=`
|
|
3
3
|
`,{stdout:t,stderr:c,exitCode:c?1:0}}};async function b(s,o,e,u,a){let t={output:"",stderr:"",dirCount:0,fileCount:0},c=s.fs.resolvePath(s.cwd,o);try{if(!(await s.fs.stat(c)).isDirectory)return t.output=`${o}
|
|
4
4
|
`,t.fileCount=1,t}catch{return t.stderr=`tree: ${o}: No such file or directory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-DXB73IDG.js";var e={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},t={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}};export{t as falseCommand,e as trueCommand};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as b,b as g,c as m}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var k={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]};function d(s){let i=s.split(",").map(o=>o.trim()),e=[];for(let o of i){let n=parseInt(o,10);if(Number.isNaN(n)||n<1)return null;e.push(n)}for(let o=1;o<e.length;o++)if(e[o]<=e[o-1])return null;return e}function v(s,i){if(i.length===1){let e=i[0];return s+(e-s%e)}for(let e of i)if(e>s)return e;if(i.length>=2){let e=i[i.length-1]-i[i.length-2],o=i[i.length-1],n=Math.floor((s-o)/e)+1;return o+n*e}return-1}function L(s,i){let{tabStops:e,allBlanks:o}=i,n="",a=0,t="",l=0,u=!0,f=()=>{if(t.length===0)return;let r=l+t.length;if(!o&&!u){n+=t,t="";return}let p=l,c="";for(;p<r;){let h=v(p,e);if(h<=r&&h>p)c+=" ",p=h;else break}let x=r-p;x>0&&(c+=" ".repeat(x)),n+=c,t=""};for(let r of s)r===" "?(t.length===0&&(l=a),t+=r,a++):r===" "?(f(),n+=r,a=v(a,e)):(f(),n+=r,a++,u=!1);return f(),n}function C(s,i){if(s==="")return"";let e=s.split(`
|
|
2
|
+
`),o=s.endsWith(`
|
|
3
|
+
`)&&e[e.length-1]==="";return o&&e.pop(),e.map(a=>L(a,i)).join(`
|
|
4
|
+
`)+(o?`
|
|
5
|
+
`:"")}var w={name:"unexpand",execute:async(s,i)=>{if(g(s))return b(k);let e={tabStops:[8],allBlanks:!1},o=[],n=0;for(;n<s.length;){let t=s[n];if(t==="-t"&&n+1<s.length){let l=d(s[n+1]);if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s[n+1]}'
|
|
6
|
+
`};e.tabStops=l,n+=2}else if(t.startsWith("-t")&&t.length>2){let l=d(t.slice(2));if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(2)}'
|
|
7
|
+
`};e.tabStops=l,n++}else if(t==="--tabs"&&n+1<s.length){let l=d(s[n+1]);if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s[n+1]}'
|
|
8
|
+
`};e.tabStops=l,n+=2}else if(t.startsWith("--tabs=")){let l=d(t.slice(7));if(!l)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(7)}'
|
|
9
|
+
`};e.tabStops=l,n++}else if(t==="-a"||t==="--all")e.allBlanks=!0,n++;else if(t==="--"){o.push(...s.slice(n+1));break}else{if(t.startsWith("-")&&t!=="-")return m("unexpand",t);o.push(t),n++}}let a="";if(o.length===0){let t=i.stdin??"";a=C(t,e)}else for(let t of o){let l=i.fs.resolvePath(i.cwd,t),u=await i.fs.readFile(l);if(u===null)return{exitCode:1,stdout:a,stderr:`unexpand: ${t}: No such file or directory
|
|
10
|
+
`};a+=C(u,e)}return{exitCode:0,stdout:a,stderr:""}}};export{w as unexpand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as g}from"./chunk-3YNHMZ5M.js";import{a as f}from"./chunk-ZVV5VXYZ.js";import{a as p,b as d}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-3YNHMZ5M.js";import{a as f}from"./chunk-ZVV5VXYZ.js";import{a as p,b as d}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var b={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"]},w={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"}},P={name:"uniq",async execute(a,m){if(d(a))return p(b);let o=f("uniq",a,w);if(!o.ok)return o.error;let{count:h,duplicatesOnly:y,uniqueOnly:q,ignoreCase:C}=o.result.flags,O=o.result.positional,u=await g(m,O,{cmdName:"uniq"});if(!u.ok)return u.error;let n=u.content.split(`
|
|
2
2
|
`);if(n.length>0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:"",stderr:"",exitCode:0};let t=[],r=n[0],i=1,x=(e,s)=>C?e.toLowerCase()===s.toLowerCase():e===s;for(let e=1;e<n.length;e++)x(n[e],r)?i++:(t.push({line:r,count:i}),r=n[e],i=1);t.push({line:r,count:i});let l=t;y?l=t.filter(e=>e.count>1):q&&(l=t.filter(e=>e.count===1));let c="";for(let{line:e,count:s}of l)h?c+=`${String(s).padStart(4)} ${e}
|
|
3
3
|
`:c+=`${e}
|
|
4
4
|
`;return{stdout:c,stderr:"",exitCode:0}}};export{P as uniqCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as y}from"./chunk-3YNHMZ5M.js";import{a as g}from"./chunk-ZVV5VXYZ.js";import{a as w,b as m}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as y}from"./chunk-3YNHMZ5M.js";import{a as g}from"./chunk-ZVV5VXYZ.js";import{a as w,b as m}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var C={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},S={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},L={name:"wc",async execute(n,l){if(m(n))return w(C);let r=g("wc",n,S);if(!r.ok)return r.error;let{lines:s,words:t}=r.result.flags,e=r.result.flags.bytes||r.result.flags.chars,o=r.result.positional;!s&&!t&&!e&&(s=t=e=!0);let i=await y(l,o,{cmdName:"wc",stopOnError:!1});if(o.length===0){let f=b(i.files[0].content);return{stdout:`${h(f,s,t,e,"")}
|
|
2
2
|
`,stderr:"",exitCode:0}}let c="",u=0,d=0,p=0;for(let{filename:f,content:x}of i.files){let a=b(x);u+=a.lines,d+=a.words,p+=a.chars,c+=`${h(a,s,t,e,f)}
|
|
3
3
|
`}return o.length>1&&(c+=`${h({lines:u,words:d,chars:p},s,t,e,"total")}
|
|
4
4
|
`),{stdout:c,stderr:i.stderr,exitCode:i.exitCode}}};function b(n){let l=n.length,r=0,s=0,t=!1;for(let e=0;e<l;e++){let o=n[e];o===`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-ZVV5VXYZ.js";import{a as f,b as h}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-ZVV5VXYZ.js";import{a as f,b as h}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var w={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},g={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(s,e){if(h(s))return f(w);let t=u("which",s,g);if(!t.ok)return t.error;let c=t.result.flags.showAll,p=t.result.flags.silent,o=t.result.positional;if(o.length===0)return{stdout:"",stderr:"",exitCode:1};let d=(e.env.PATH||"/bin:/usr/bin").split(":"),n="",r=!0;for(let m of o){let a=!1;for(let i of d){if(!i)continue;let l=`${i}/${m}`;if(await e.fs.exists(l)&&(a=!0,p||(n+=`${l}
|
|
2
2
|
`),!c))break}a||(r=!1)}return{stdout:n,stderr:"",exitCode:r?0:1}}};export{A as whichCommand};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import{a as v,b as w,c as H,d as J}from"./chunk-U4UYWYTO.js";import{a as ze}from"./chunk-SYMJJMQ4.js";import{a as O}from"./chunk-4JO5BKO4.js";import"./chunk-CG2HXOFG.js";import{a as $,b as _}from"./chunk-74CEPOFO.js";import{b as qe,d as _e,e as He,f as Je}from"./chunk-DXB73IDG.js";var Re={};_e(Re,{parseMoonblade:()=>V,parseNamedExpressions:()=>T});function T(e){let n=[],s=new W(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},a=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){a();continue}let p=[],u=0,f=r;for(;o().type!=="eof";){let i=o();if((i.type===","||i.type==="as")&&u===0)break;(i.type==="("||i.type==="["||i.type==="{")&&u++,(i.type===")"||i.type==="]"||i.type==="}")&&u--,p.push(a())}p.push({type:"eof",value:"",pos:0});let h=new U(p).parse(),c;if(o().type==="as")if(a(),o().type==="("){a();let i=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(i.push(o().value),a()),o().type===","&&a();o().type===")"&&a(),c=i}else if(o().type==="ident"||o().type==="string")c=o().value,a();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[f].pos,s[r-1]?.pos||e.length).trim(),h.type==="identifier"&&(c=h.name);n.push({expr:h,name:c})}return n}function V(e){let t=new W(e).tokenize();return new U(t).parse()}var W,P,U,j=qe(()=>{"use strict";W=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
|
|
2
|
+
`||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
|
|
3
|
+
`;)this.pos++;else break}}nextToken(){let n=this.pos,t=this.input[this.pos];if(t>="0"&&t<="9")return this.readNumber();if(t==='"'||t==="'"||t==="`")return this.readString(t);if(t==="b"&&this.pos+1<this.input.length){let r=this.input[this.pos+1];if(r==='"'||r==="'"||r==="`")return this.pos++,this.readString(r)}if(t==="/"){let r=this.tokens[this.tokens.length-1];return r&&(r.type==="int"||r.type==="float"||r.type==="string"||r.type==="ident"||r.type===")"||r.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:n}):(this.pos++,{type:"/",value:"/",pos:n}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:n};if(this.match("=>"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let s={"(":"(",")":")","[":"[","]":"]","{":"{","}":"}",",":",",":":":",";":";","+":"+","-":"-","*":"*","%":"%","<":"<",">":">","!":"!",".":".","|":"|","=":"="};if(t in s)return this.pos++,{type:s[t],value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(n,this.pos).replace(/_/g,"");return{type:t?"float":"int",value:r,pos:n}}readString(n){let t=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===n)return this.pos++,{type:"string",value:s,pos:t};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
|
|
4
|
+
`;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(s+="?");let r={true:"true",false:"false",null:"null",and:"and",or:"or",eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",in:"in",as:"as",_:"_"},o=s.replace(/\?$/,"");return o in r&&!t?{type:r[o],value:o,pos:n}:{type:"ident",value:s,pos:n}}},P={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},U=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=[];if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=this.peek().value;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(P.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(P.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,a=this.pos+1;a<this.tokens.length&&this.tokens[a].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),r={"+":"add","-":"sub","*":"mul","/":"div","//":"idiv","%":"mod","**":"pow","++":"concat","==":"==","!=":"!=","<":"<","<=":"<=",">":">",">=":">=",eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge","&&":"and",and:"and","||":"or",or:"or"};if(s.type in r){this.advance();let o=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:r[s.type],args:[{expr:n},{expr:o}]}}if(s.type==="|"){this.advance();let o=this.parseExpr(t);return this.handlePipe(n,o)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return P.PIPE;case"||":case"or":return P.OR;case"&&":case"and":return P.AND;case"==":case"!=":case"eq":case"ne":return P.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return P.COMPARISON;case"+":case"-":case"++":return P.ADDITIVE;case"*":case"/":case"//":case"%":return P.MULTIPLICATIVE;case"**":return P.POWER;case".":case"[":return P.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});j();function N(e,n){return n.length===0?I(e,[]):n.length===1?{type:"Pipe",left:n[0],right:I(e,[])}:{type:"Pipe",left:n[0],right:I(e,n.slice(1))}}var Te={add:e=>b("+",e[0],e[1]),sub:e=>b("-",e[0],e[1]),mul:e=>b("*",e[0],e[1]),div:e=>b("/",e[0],e[1]),mod:e=>b("%",e[0],e[1]),idiv:e=>I("floor",[b("/",e[0],e[1])]),pow:e=>N("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>b("==",e[0],e[1]),"!=":e=>b("!=",e[0],e[1]),"<":e=>b("<",e[0],e[1]),"<=":e=>b("<=",e[0],e[1]),">":e=>b(">",e[0],e[1]),">=":e=>b(">=",e[0],e[1]),eq:e=>b("==",F(e[0]),F(e[1])),ne:e=>b("!=",F(e[0]),F(e[1])),lt:e=>b("<",F(e[0]),F(e[1])),le:e=>b("<=",F(e[0]),F(e[1])),gt:e=>b(">",F(e[0]),F(e[1])),ge:e=>b(">=",F(e[0]),F(e[1])),and:e=>b("and",e[0],e[1]),or:e=>b("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>N("length",e),length:e=>N("length",e),upper:e=>N("ascii_upcase",e),lower:e=>N("ascii_downcase",e),trim:e=>N("trim",e),ltrim:e=>e.length===0?I("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:I("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?I("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:I("rtrimstr",[{type:"Literal",value:" "}])},split:e=>N("split",e),join:e=>e.length===1?I("join",[{type:"Literal",value:""}]):N("join",e),concat:e=>b("+",e[0],e[1]),startswith:e=>N("startswith",e),endswith:e=>N("endswith",e),contains:e=>N("contains",e),replace:e=>N("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:b("+",e[1],e[2])},abs:e=>N("fabs",e),floor:e=>N("floor",e),ceil:e=>N("ceil",e),round:e=>N("round",e),sqrt:e=>N("sqrt",e),log:e=>N("log",e),log10:e=>N("log10",e),log2:e=>N("log2",e),exp:e=>N("exp",e),sin:e=>N("sin",e),cos:e=>N("cos",e),tan:e=>N("tan",e),asin:e=>N("asin",e),acos:e=>N("acos",e),atan:e=>N("atan",e),min:e=>N("min",e),max:e=>N("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>I("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>I("select",e),empty:()=>I("empty",[]),count:()=>I("length",[]),sum:e=>e.length===0?I("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:I("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:b("/",I("add",[]),I("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:b("/",I("add",[]),I("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:b("/",I("add",[]),I("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:b("/",I("add",[]),I("length",[]))},type:"type",isnull:e=>e.length===0?b("==",{type:"Identity"},{type:"Literal",value:null}):b("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?b("==",{type:"Identity"},{type:"Literal",value:""}):b("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?I("tonumber",[]):I("tonumber",e),tostring:e=>e.length===0?I("tostring",[]):I("tostring",e),if:e=>$e(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=b("and",b("!=",n,{type:"Literal",value:null}),b("!=",n,{type:"Literal",value:""}));return $e(s,n,t.length===1?t[0]:Te.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>I("now",[]),fmt:e=>I("tostring",e),format:e=>I("tostring",e)};function b(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function I(e,n){return{type:"Call",name:e,args:n}}var Ke="then";function $e(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[Ke]=n,s}function F(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function A(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>A(r.expr,n)),s=Te[e.name];return typeof s=="function"?s(t):I(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=A(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:A(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?A(e.start,n):void 0,end:e.end?A(e.end,n):void 0};case"lambda":return A(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function K(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,a=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let p=e.slice(a,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let f=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(f,t)}u||(u=p?`${r}(${p})`:`${r}()`),n.push({func:r,expr:p,alias:u})}return n}function je(e){return/^\w+$/.test(e)}function z(e,n,t){let s=A(V(n)),r=O(e,s,t);return r.length>0?r[0]:null}function G(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(je(r)?o=e.map(a=>a[r]).filter(a=>a!=null):o=e.map(a=>z(a,r,t)).filter(a=>a!=null),s){case"count":return je(r)?o.length:o.filter(a=>!!a).length;case"sum":return o.map(p=>typeof p=="number"?p:Number.parseFloat(String(p))).reduce((p,u)=>p+u,0);case"mean":case"avg":{let a=o.map(p=>typeof p=="number"?p:Number.parseFloat(String(p)));return a.length>0?a.reduce((p,u)=>p+u,0)/a.length:0}case"min":{let a=o.map(p=>typeof p=="number"?p:Number.parseFloat(String(p)));return a.length>0?Math.min(...a):null}case"max":{let a=o.map(p=>typeof p=="number"?p:Number.parseFloat(String(p)));return a.length>0?Math.max(...a):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let a=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,f)=>u-f);if(a.length===0)return null;let p=Math.floor(a.length/2);return a.length%2===0?(a[p-1]+a[p])/2:a[p]}case"mode":{let a=new Map;for(let f of o){let l=String(f);a.set(l,(a.get(l)||0)+1)}let p=0,u=null;for(let[f,l]of a)l>p&&(p=l,u=f);return u}case"cardinality":return new Set(o.map(p=>String(p))).size;case"values":return o.map(a=>String(a)).join("|");case"distinct_values":return[...new Set(o.map(p=>String(p)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let a of e)if(!z(a,r,t))return!1;return!0}case"any":{for(let a of e)if(z(a,r,t))return!0;return!1}default:return null}}function De(e,n,t={}){let s={};for(let r of n)s[r.alias]=G(e,r,t);return s}async function X(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
|
|
5
|
+
`,exitCode:1};let{data:r,error:o}=await w(s,n);if(o)return o;let a={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},p=K(t),u=p.map(l=>l.alias),f=De(r,p,a);return{stdout:v(u,[f]),stderr:"",exitCode:0}}async function Y(e,n){let t="",s="",r=[];for(let d=0;d<e.length;d++){let m=e[d];m==="--sorted"||m.startsWith("-")||(t?s?r.push(m):s=m:t=m)}if(!t||!s)return{stdout:"",stderr:`xan groupby: usage: xan groupby COLS EXPR [FILE]
|
|
6
|
+
`,exitCode:1};let{data:o,error:a}=await w(r,n);if(a)return a;let p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),f=K(s),l=[],h=new Map;for(let d of o){let m=u.map(g=>String(d[g])).join("\0");h.has(m)||(h.set(m,[]),l.push(m)),h.get(m)?.push(d)}let c=[...u,...f.map(d=>d.alias)],i=[];for(let d of l){let m=h.get(d);if(!m)continue;let g={};for(let y of u)g[y]=m[0][y];for(let y of f)g[y.alias]=G(m,y,p);i.push(g)}return{stdout:v(c,i),stderr:"",exitCode:0}}async function B(e,n){let t=[],s="",r=10,o=!1,a=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-s"||d==="--select")&&i+1<e.length?t=e[++i].split(","):(d==="-g"||d==="--groupby")&&i+1<e.length?s=e[++i]:(d==="-l"||d==="--limit")&&i+1<e.length?r=Number.parseInt(e[++i],10):d==="--no-extra"?o=!0:d==="-A"||d==="--all"?r=0:d.startsWith("-")||a.push(d)}let{headers:p,data:u,error:f}=await w(a,n);if(f)return f;let l=t.length>0?t:p.filter(i=>i!==s);s&&t.length===0&&(l=p.filter(i=>i!==s));let h=[],c=s?["field",s,"value","count"]:["field","value","count"];if(s){let i=new Map;for(let d of u){let m=String(d[s]??"");i.has(m)||i.set(m,[]),i.get(m)?.push(d)}for(let d of l)for(let[m,g]of i){let y=new Map;for(let S of g){let k=S[d],C=k===""||k===null||k===void 0?"":String(k);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((S,k)=>k[1]!==S[1]?k[1]-S[1]:S[0].localeCompare(k[0]));o&&(x=x.filter(([S])=>S!=="")),r>0&&(x=x.slice(0,r));for(let[S,k]of x)h.push({field:d,[s]:m,value:S===""?"<empty>":S,count:k})}}else for(let i of l){let d=new Map;for(let g of u){let y=g[i],x=y===""||y===null||y===void 0?"":String(y);d.set(x,(d.get(x)||0)+1)}let m=[...d.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)h.push({field:i,value:g===""?"<empty>":g,count:y})}return{stdout:v(c,h),stderr:"",exitCode:0}}async function Z(e,n){let t=[],s=[];for(let l=0;l<e.length;l++){let h=e[l];h==="-s"&&l+1<e.length?t=e[++l].split(","):h.startsWith("-")||s.push(h)}let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=t.length>0?t:r,u=["field","type","count","min","max","mean"],f=[];for(let l of p){let h=o.map(d=>d[l]).filter(d=>d!=null),c=h.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).filter(d=>!Number.isNaN(d)),i=c.length===h.length&&c.length>0;f.push({field:l,type:i?"Number":"String",count:h.length,min:i?Math.min(...c):"",max:i?Math.max(...c):"",mean:i?Math.round(c.reduce((d,m)=>d+m,0)/c.length*1e10)/1e10:""})}return{stdout:v(u,f),stderr:"",exitCode:0}}j();function Ve(e){let n=V(e);return A(n)}function Ge(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}function q(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let f=o.slice(1),l=q(f,n);for(let h of l)s.add(h);continue}if(o==="*"){for(let f of n)t.includes(f)||t.push(f);continue}if(o.includes("*")){let f=Ge(o);for(let l of n)f.test(l)&&!t.includes(l)&&t.push(l);continue}let a=o.match(/^([^:]*):([^:]*)$/);if(a&&(a[1]||a[2])){let f=a[1],l=a[2],h=f?n.indexOf(f):0,c=l?n.indexOf(l):n.length-1;if(h!==-1&&c!==-1){let i=h<=c?1:-1;for(let d=h;i>0?d<=c:d>=c;d+=i)t.includes(n[d])||t.push(n[d])}continue}let p=o.match(/^(\d+)-(\d+)$/);if(p){let f=Number.parseInt(p[1],10),l=Number.parseInt(p[2],10);for(let h=f;h<=l&&h<n.length;h++)t.push(n[h]);continue}let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0&&u<n.length){t.push(n[u]);continue}n.includes(o)&&t.push(o)}return s.size>0?t.filter(r=>!s.has(r)):t}async function Q(e,n){let t="",s=[];for(let f of e)f.startsWith("-")||(t?s.push(f):t=f);if(!t)return{stdout:"",stderr:`xan select: no columns specified
|
|
7
|
+
`,exitCode:1};let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=q(t,r),u=o.map(f=>{let l={};for(let h of p)l[h]=f[h];return l});return{stdout:v(p,u),stderr:"",exitCode:0}}async function ee(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan drop: no columns specified
|
|
8
|
+
`,exitCode:1};let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=new Set(q(t,r)),u=r.filter(l=>!p.has(l)),f=o.map(l=>{let h={};for(let c of u)h[c]=l[c];return h});return{stdout:v(u,f),stderr:"",exitCode:0}}async function te(e,n){let t="",s="",r=[];for(let l=0;l<e.length;l++){let h=e[l];h==="-s"&&l+1<e.length?s=e[++l]:h.startsWith("-")||(t?r.push(h):t=h)}if(!t)return{stdout:"",stderr:`xan rename: no new name(s) specified
|
|
9
|
+
`,exitCode:1};let{headers:o,data:a,error:p}=await w(r,n);if(p)return p;let u;if(s){let l=s.split(","),h=t.split(","),c=new Map;for(let i=0;i<l.length&&i<h.length;i++)c.set(l[i],h[i]);u=o.map(i=>c.get(i)||i)}else{let l=t.split(",");u=o.map((h,c)=>c<l.length?l[c]:h)}let f=a.map(l=>{let h={};for(let c=0;c<o.length;c++)h[u[c]]=l[o[c]];return h});return{stdout:v(u,f),stderr:"",exitCode:0}}async function ne(e,n){let t="index",s=[];for(let f=0;f<e.length;f++)e[f]==="-c"&&f+1<e.length?t=e[++f]:s.push(e[f]);let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=[t,...r],u=o.map((f,l)=>{let h={[t]:l};for(let c of r)h[c]=f[c];return h});return{stdout:v(p,u),stderr:"",exitCode:0}}async function se(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await w(e.filter(a=>a!=="-j"&&a!=="--just-names"),n);return r||{stdout:t?`${s.map(a=>a).join(`
|
|
10
|
+
`)}
|
|
11
|
+
`:`${s.map((a,p)=>`${p} ${a}`).join(`
|
|
12
|
+
`)}
|
|
13
|
+
`,stderr:"",exitCode:0}}async function re(e,n){let{data:t,error:s}=await w(e,n);return s||{stdout:`${t.length}
|
|
14
|
+
`,stderr:"",exitCode:0}}async function oe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=o.slice(0,t);return{stdout:v(r,p),stderr:"",exitCode:0}}async function ie(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=o.slice(-t);return{stdout:v(r,p),stderr:"",exitCode:0}}async function ae(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let i=e[c];(i==="-s"||i==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(i==="-e"||i==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(i==="-l"||i==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):i.startsWith("-")||o.push(i)}let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;let f=t??0,l;r!==void 0?l=f+r:s!==void 0?l=s:l=p.length;let h=p.slice(f,l);return{stdout:v(a,h),stderr:"",exitCode:0}}async function le(e,n){let{headers:t,data:s,error:r}=await w(e,n);if(r)return r;let o=[...s].reverse();return{stdout:v(t,o),stderr:"",exitCode:0}}var ue=He(ze(),1);async function ce(e,n){let t=e.filter(f=>!f.startsWith("-")),{headers:s,data:r,error:o}=await w(t,n);if(o)return o;if(r.length===0){let f=["column"],l=s.map(h=>({column:h}));return{stdout:v(f,l),stderr:"",exitCode:0}}let a=s[0],p=[a,...r.map((f,l)=>String(f[a]??`row_${l}`))],u=[];for(let f=1;f<s.length;f++){let l=s[f],h={[a]:l};for(let c=0;c<r.length;c++)h[p[c+1]]=r[c][l];u.push(h)}return{stdout:v(p,u),stderr:"",exitCode:0}}async function pe(e,n){let t=null,s=[];for(let l=0;l<e.length;l++){let h=e[l];h==="--seed"&&l+1<e.length?t=Number.parseInt(e[++l],10):h.startsWith("-")||s.push(h)}let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=t!==null?t:Date.now(),u=()=>(p=p*1103515245+12345&2147483647,p/2147483647),f=[...o];for(let l=f.length-1;l>0;l--){let h=Math.floor(u()*(l+1));[f[l],f[h]]=[f[h],f[l]]}return{stdout:v(r,f),stderr:"",exitCode:0}}async function fe(e,n){let t=null,s="",r=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-l"||d==="--length")&&i+1<e.length?t=Number.parseInt(e[++i],10):(d==="-d"||d==="--default")&&i+1<e.length?s=e[++i]:d.startsWith("-")||r.push(d)}let o=r[0],a;if(!o||o==="-")a=n.stdin;else try{let i=n.fs.resolvePath(n.cwd,o);a=await n.fs.readFile(i)}catch{return{stdout:"",stderr:`xan fixlengths: ${o}: No such file or directory
|
|
15
|
+
`,exitCode:1}}let u=ue.default.parse(a.trim(),{header:!1,skipEmptyLines:!0}).data;if(u.length===0)return{stdout:"",stderr:"",exitCode:0};let f=Math.max(...u.map(i=>i.length)),l=t??f,h=u.map(i=>i.length===l?i:i.length<l?[...i,...Array(l-i.length).fill(s)]:i.slice(0,l));return{stdout:`${ue.default.unparse(h).replace(/\r\n/g,`
|
|
16
|
+
`)}
|
|
17
|
+
`,stderr:"",exitCode:0}}async function de(e,n){let t=null,s=null,r=".",o=[];for(let c=0;c<e.length;c++){let i=e[c];(i==="-c"||i==="--chunks")&&c+1<e.length?t=Number.parseInt(e[++c],10):(i==="-S"||i==="--size")&&c+1<e.length?s=Number.parseInt(e[++c],10):(i==="-o"||i==="--output")&&c+1<e.length?r=e[++c]:i.startsWith("-")||o.push(i)}if(!t&&!s)return{stdout:"",stderr:`xan split: must specify -c or -S
|
|
18
|
+
`,exitCode:1};let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;let f=[];if(t){let c=Math.ceil(p.length/t);for(let i=0;i<t;i++)f.push(p.slice(i*c,(i+1)*c))}else if(s)for(let c=0;c<p.length;c+=s)f.push(p.slice(c,c+s));let l=f.filter(c=>c.length>0),h=o[0]?.replace(/\.csv$/,"")||"part";try{let c=n.fs.resolvePath(n.cwd,r);for(let i=0;i<l.length;i++){let d=`${h}_${String(i+1).padStart(3,"0")}.csv`,m=n.fs.resolvePath(c,d);await n.fs.writeFile(m,v(a,l[i]))}return{stdout:`Split into ${l.length} parts
|
|
19
|
+
`,stderr:"",exitCode:0}}catch{return{stdout:`${l.map((i,d)=>`Part ${d+1}: ${i.length} rows`).join(`
|
|
20
|
+
`)}
|
|
21
|
+
`,stderr:"",exitCode:0}}}async function he(e,n){let t="",s=".",r=[];for(let f=0;f<e.length;f++){let l=e[f];(l==="-o"||l==="--output")&&f+1<e.length?s=e[++f]:l.startsWith("-")||(t?r.push(l):t=l)}if(!t)return{stdout:"",stderr:`xan partition: usage: xan partition COLUMN [FILE]
|
|
22
|
+
`,exitCode:1};let{headers:o,data:a,error:p}=await w(r,n);if(p)return p;if(!o.includes(t))return{stdout:"",stderr:`xan partition: column '${t}' not found
|
|
23
|
+
`,exitCode:1};let u=new Map;for(let f of a){let l=String(f[t]??"");u.has(l)||u.set(l,[]),u.get(l)?.push(f)}try{let f=n.fs.resolvePath(n.cwd,s);for(let[l,h]of u){let i=`${l.replace(/[^a-zA-Z0-9_-]/g,"_")||"empty"}.csv`,d=n.fs.resolvePath(f,i);await n.fs.writeFile(d,v(o,h))}return{stdout:`Partitioned into ${u.size} files by '${t}'
|
|
24
|
+
`,stderr:"",exitCode:0}}catch{return{stdout:`${Array.from(u.entries()).map(([l,h])=>`${l}: ${h.length} rows`).join(`
|
|
25
|
+
`)}
|
|
26
|
+
`,stderr:"",exitCode:0}}}async function me(e,n){if(e.length===0)return{stdout:"",stderr:`xan to: usage: xan to <format> [FILE]
|
|
27
|
+
`,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?Xe(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}'
|
|
28
|
+
`,exitCode:1}}async function Xe(e,n){let t=e.filter(a=>!a.startsWith("-")),{data:s,error:r}=await w(t,n);return r||{stdout:`${JSON.stringify(s,null,2)}
|
|
29
|
+
`,stderr:"",exitCode:0}}async function ge(e,n){let t="",s=[];for(let r=0;r<e.length;r++){let o=e[r];(o==="-f"||o==="--format")&&r+1<e.length?t=e[++r]:o.startsWith("-")||s.push(o)}return t?t==="json"?Ye(s,n):{stdout:"",stderr:`xan from: unsupported format '${t}'
|
|
30
|
+
`,exitCode:1}:{stdout:"",stderr:`xan from: usage: xan from -f <format> [FILE]
|
|
31
|
+
`,exitCode:1}}async function Ye(e,n){let t=e[0],s;if(!t||t==="-")s=n.stdin;else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory
|
|
32
|
+
`,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array
|
|
33
|
+
`,exitCode:1};if(r.length===0)return{stdout:`
|
|
34
|
+
`,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[a,...p]=r,u=p.map(f=>{let l={};for(let h=0;h<a.length;h++)l[a[h]]=f[h];return l});return{stdout:v(a,u),stderr:"",exitCode:0}}let o=Object.keys(r[0]).sort();return{stdout:v(o,r),stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`xan from: invalid JSON input
|
|
35
|
+
`,exitCode:1}}}async function ye(e,n){let t=!1,s=0,r="",o=[];for(let c=0;c<e.length;c++){let i=e[c];if(i==="-v"||i==="--invert")t=!0;else if((i==="-l"||i==="--limit")&&c+1<e.length)s=Number.parseInt(e[++c],10);else{if(i==="--help")return $({name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output to N rows"," --help display help"]});i.startsWith("-")||(r?o.push(i):r=i)}}if(!r)return{stdout:"",stderr:`xan filter: no expression specified
|
|
36
|
+
`,exitCode:1};let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;let f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=Ve(r),h=[];for(let c of p){if(s>0&&h.length>=s)break;let i=O(c,l,f),d=i.length>0&&i.some(m=>!!m);(t?!d:d)&&h.push(c)}return{stdout:v(a,h),stderr:"",exitCode:0}}async function xe(e,n){let t="",s=!1,r=!1,o=[];for(let l=0;l<e.length;l++){let h=e[l];h==="-N"||h==="--numeric"?s=!0:h==="-R"||h==="-r"||h==="--reverse"?r=!0:h==="-s"&&l+1<e.length?t=e[++l]:h.startsWith("-")||o.push(h)}let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;!t&&a.length>0&&(t=a[0]);let f=[...p].sort((l,h)=>{let c=l[t],i=h[t],d;if(s){let m=typeof c=="number"?c:Number.parseFloat(String(c)),g=typeof i=="number"?i:Number.parseFloat(String(i));d=m-g}else d=String(c).localeCompare(String(i));return r?-d:d});return{stdout:v(a,f),stderr:"",exitCode:0}}async function we(e,n){let t="",s=[];for(let f=0;f<e.length;f++){let l=e[f];l==="-s"&&f+1<e.length?t=e[++f]:l.startsWith("-")||s.push(l)}let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let p=new Set,u=o.filter(f=>{let l=t?String(f[t]):JSON.stringify(f);return p.has(l)?!1:(p.add(l),!0)});return{stdout:v(r,u),stderr:"",exitCode:0}}async function ve(e,n){let t=10,s="",r=!1,o=[];for(let h=0;h<e.length;h++){let c=e[h];(c==="-l"||c==="-n")&&h+1<e.length?t=Number.parseInt(e[++h],10):c==="-R"||c==="-r"||c==="--reverse"?r=!0:c.startsWith("-")||(s?o.push(c):s=c)}let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;!s&&a.length>0&&(s=a[0]);let l=[...p].sort((h,c)=>{let i=h[s],d=c[s],m=typeof i=="number"?i:Number.parseFloat(String(i)),g=typeof d=="number"?d:Number.parseFloat(String(d));return r?m-g:g-m}).slice(0,t);return{stdout:v(a,l),stderr:"",exitCode:0}}j();async function Ce(e,n){let t="",s=!1,r=!1,o=[];for(let d=0;d<e.length;d++){let m=e[d];m==="-O"||m==="--overwrite"?s=!0:m==="--filter"?r=!0:m.startsWith("-")||(t?o.push(m):t=m)}if(!t)return{stdout:"",stderr:`xan map: no expression specified
|
|
37
|
+
`,exitCode:1};let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;let l=T(t).map(({expr:d,name:m})=>({alias:typeof m=="string"?m:m[0],ast:A(d)})),h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c;if(s){c=[...a];for(let d of l)a.includes(d.alias)||c.push(d.alias)}else c=[...a,...l.map(d=>d.alias)];let i=[];for(let d=0;d<p.length;d++){let m=p[d],g={...m},y=!1,x={...m,_row_index:d};for(let S of l){let k=O(x,S.ast,h),C=k.length>0?k[0]:null;if(r&&C==null){y=!0;break}g[S.alias]=C}y||i.push(g)}return{stdout:v(c,i),stderr:"",exitCode:0}}async function be(e,n){let t="",s="",r="",o=[];for(let m=0;m<e.length;m++){let g=e[m];(g==="-r"||g==="--rename")&&m+1<e.length?r=e[++m]:g.startsWith("-")||(t?s?o.push(g):s=g:t=g)}if(!t||!s)return{stdout:"",stderr:`xan transform: usage: xan transform COLUMN EXPR [FILE]
|
|
38
|
+
`,exitCode:1};let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;let f=t.split(",").map(m=>m.trim()),l=r?r.split(",").map(m=>m.trim()):[];for(let m of f)if(!a.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found
|
|
39
|
+
`,exitCode:1};let h=A(T(s)[0]?.expr||(j(),Je(Re)).parseMoonblade(s)),c={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},i=a.map(m=>{let g=f.indexOf(m);return g!==-1&&l[g]?l[g]:m}),d=[];for(let m of p){let g={...m};for(let y=0;y<f.length;y++){let x=f[y],S={...m,_:m[x]},k=O(S,h,c),C=k.length>0?k[0]:null,E=l[y]||x;E!==x&&delete g[x],g[E]=C}d.push(g)}return{stdout:v(i,d),stderr:"",exitCode:0}}async function Se(e,n){let t="",s="|",r=!1,o="",a=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-s"||d==="--separator")&&i+1<e.length?s=e[++i]:d==="--drop-empty"?r=!0:(d==="-r"||d==="--rename")&&i+1<e.length?o=e[++i]:d.startsWith("-")||(t?a.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan explode: usage: xan explode COLUMN [FILE]
|
|
40
|
+
`,exitCode:1};let{headers:p,data:u,error:f}=await w(a,n);if(f)return f;if(!p.includes(t))return{stdout:"",stderr:`xan explode: column '${t}' not found
|
|
41
|
+
`,exitCode:1};let l=o?p.map(i=>i===t?o:i):p,h=o||t,c=[];for(let i of u){let d=i[t],m=d==null?"":String(d);if(m===""){if(!r){let g={...i};o&&(delete g[t],g[h]=""),c.push(g)}}else{let g=m.split(s);for(let y of g){let x={...i};o&&delete x[t],x[h]=y,c.push(x)}}}return{stdout:v(l,c),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s="|",r="",o=[];for(let g=0;g<e.length;g++){let y=e[g];(y==="-s"||y==="--sep")&&g+1<e.length?s=e[++g]:(y==="-r"||y==="--rename")&&g+1<e.length?r=e[++g]:y.startsWith("-")||(t?o.push(y):t=y)}if(!t)return{stdout:"",stderr:`xan implode: usage: xan implode COLUMN [FILE]
|
|
42
|
+
`,exitCode:1};let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;if(!a.includes(t))return{stdout:"",stderr:`xan implode: column '${t}' not found
|
|
43
|
+
`,exitCode:1};let f=a.filter(g=>g!==t),l=r?a.map(g=>g===t?r:g):a,h=r||t,c=[],i=null,d=[],m=null;for(let g of p){let y=f.map(k=>String(g[k]??"")).join("\0"),x=g[t],S=x==null?"":String(x);if(y!==i){if(m!==null){let k={...m};r&&delete k[t],k[h]=d.join(s),c.push(k)}i=y,d=[S],m=g}else d.push(S)}if(m!==null){let g={...m};r&&delete g[t],g[h]=d.join(s),c.push(g)}return{stdout:v(l,c),stderr:"",exitCode:0}}async function ke(e,n){let t="",s="",r="",o="",a="inner",p="",u=0;for(let C=0;C<e.length;C++){let E=e[C];E==="--left"?a="left":E==="--right"?a="right":E==="--full"?a="full":(E==="-D"||E==="--default")&&C+1<e.length?p=e[++C]:E.startsWith("-")||(u++,u===1?t=E:u===2?s=E:u===3?r=E:u===4&&(o=E))}if(!t||!s||!r||!o)return{stdout:"",stderr:`xan join: usage: xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]
|
|
44
|
+
`,exitCode:1};let f=await w([s],n);if(f.error)return f.error;let l=await w([o],n);if(l.error)return l.error;let{headers:h,data:c}=f,{headers:i,data:d}=l;if(!h.includes(t))return{stdout:"",stderr:`xan join: column '${t}' not found in first file
|
|
45
|
+
`,exitCode:1};if(!i.includes(r))return{stdout:"",stderr:`xan join: column '${r}' not found in second file
|
|
46
|
+
`,exitCode:1};let m=new Map;for(let C of d){let E=String(C[r]??"");m.has(E)||m.set(E,[]),m.get(E)?.push(C)}let g=new Set(h),y=i.filter(C=>!g.has(C)),x=[...h,...y],S=[],k=new Set;for(let C of c){let E=String(C[t]??""),R=m.get(E);if(R&&R.length>0){k.add(E);for(let L of R){let M={};for(let D of h)M[D]=C[D];for(let D of y)M[D]=L[D];S.push(M)}}else if(a==="left"||a==="full"){let L={};for(let M of h)L[M]=C[M];for(let M of y)L[M]=p;S.push(L)}}if(a==="right"||a==="full")for(let C of d){let E=String(C[r]??"");if(!k.has(E)){let R={};for(let L of h)R[L]=i.includes(L)?C[L]:p;for(let L of y)R[L]=C[L];S.push(R)}}return{stdout:v(x,S),stderr:"",exitCode:0}}async function Ne(e,n){let t="",s="",r=[],o=[];for(let y=0;y<e.length;y++){let x=e[y];(x==="-g"||x==="--groupby")&&y+1<e.length?r=e[++y].split(",").map(S=>S.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]
|
|
47
|
+
`,exitCode:1};let{headers:a,data:p,error:u}=await w(o,n);if(u)return u;if(!a.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found
|
|
48
|
+
`,exitCode:1};let f=s.match(/^(\w+)\((\w+)\)$/);if(!f)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}'
|
|
49
|
+
`,exitCode:1};let[,l,h]=f;r.length===0&&(r=a.filter(y=>y!==t&&y!==h));let c=[];for(let y of p){let x=String(y[t]??"");c.includes(x)||c.push(x)}let i=new Map,d=[];for(let y of p){let x=r.map(E=>String(y[E]??"")).join("\0"),S=String(y[t]??""),k=y[h];i.has(x)||(i.set(x,new Map),d.push(x));let C=i.get(x);C&&(C.has(S)||C.set(S,[]),C.get(S)?.push(k))}let m=[...r,...c],g=[];for(let y of d){let x=y.split("\0"),S=i.get(y);if(!S)continue;let k={};for(let C=0;C<r.length;C++)k[r[C]]=x[C];for(let C of c){let E=S.get(C)||[];k[C]=Be(l,E)}g.push(k)}return{stdout:v(m,g),stderr:"",exitCode:0}}function Be(e,n){let t=n.filter(s=>s!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Ee(e,n){let t="",s=[];for(let p=0;p<e.length;p++){let u=e[p];(u==="-s"||u==="--sort")&&p+1<e.length?t=e[++p]:u.startsWith("-")||s.push(u)}if(s.length<2)return{stdout:"",stderr:`xan merge: usage: xan merge [OPTIONS] FILE1 FILE2 ...
|
|
50
|
+
`,exitCode:1};let r=[],o=null;for(let p of s){let u=await w([p],n);if(u.error)return u.error;if(o===null)o=u.headers;else if(JSON.stringify(o)!==JSON.stringify(u.headers))return{stdout:"",stderr:`xan merge: all files must have the same headers
|
|
51
|
+
`,exitCode:1};r.push({headers:u.headers,data:u.data})}if(!o)return{stdout:"",stderr:"",exitCode:0};let a=[];for(let{data:p}of r)a=a.concat(p);if(t){if(!o.includes(t))return{stdout:"",stderr:`xan merge: column '${t}' not found
|
|
52
|
+
`,exitCode:1};a.sort((p,u)=>{let f=p[t],l=u[t],h=typeof f=="number"?f:Number.parseFloat(String(f)),c=typeof l=="number"?l:Number.parseFloat(String(l));return!Number.isNaN(h)&&!Number.isNaN(c)?h-c:String(f??"").localeCompare(String(l??""))})}return{stdout:v(o,a),stderr:"",exitCode:0}}j();async function Ae(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await w(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(f=>u[f])).map(u=>u.map(f=>Ze(f)).join(",")).join(`
|
|
53
|
+
`)+`
|
|
54
|
+
`,stderr:"",exitCode:0})}function Ze(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(`
|
|
55
|
+
`)?`"${n.replace(/"/g,'""')}"`:n}async function Le(e,n){let t=null,s=null,r=[];for(let c=0;c<e.length;c++){let i=e[c];if(i==="--seed"&&c+1<e.length)s=Number.parseInt(e[++c],10);else if(!i.startsWith("-")){let d=Number.parseInt(i,10);t===null&&!Number.isNaN(d)&&d>0?t=d:r.push(i)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample <sample-size> [FILE]
|
|
56
|
+
`,exitCode:1};let{headers:o,data:a,error:p}=await w(r,n);if(p)return p;if(a.length<=t)return{stdout:v(o,a),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),f=()=>(u=u*1103515245+12345&2147483647,u/2147483647),l=a.map((c,i)=>i);for(let c=l.length-1;c>0;c--){let i=Math.floor(f()*(c+1));[l[c],l[i]]=[l[i],l[c]]}let h=l.slice(0,t).sort((c,i)=>c-i).map(c=>a[c]);return{stdout:v(o,h),stderr:"",exitCode:0}}async function Fe(e,n){let t=!1,s=[];for(let p=0;p<e.length;p++){let u=e[p];u==="-p"||u==="--pad"?t=!0:u.startsWith("-")||s.push(u)}if(s.length===0)return{stdout:"",stderr:`xan cat: no files specified
|
|
57
|
+
`,exitCode:1};let r=[],o=[];for(let p of s){let u=await w([p],n);if(u.error)return u.error;r.push({headers:u.headers,data:u.data});for(let f of u.headers)o.includes(f)||o.push(f)}if(!t){let p=JSON.stringify(r[0].headers);for(let u=1;u<r.length;u++)if(JSON.stringify(r[u].headers)!==p)return{stdout:"",stderr:`xan cat: headers do not match (use -p to pad)
|
|
58
|
+
`,exitCode:1};o=r[0].headers}let a=[];for(let{headers:p,data:u}of r)for(let f of u){let l={};for(let h of o)l[h]=p.includes(h)?f[h]:"";a.push(l)}return{stdout:v(o,a),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s=[],r=!1,o=!1,a=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-s"||d==="--select")&&i+1<e.length?s=e[++i].split(","):d==="-v"||d==="--invert"?r=!0:d==="-i"||d==="--ignore-case"?o=!0:d==="-r"||d==="--regex"||d.startsWith("-")||(t?a.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan search: no pattern specified
|
|
59
|
+
`,exitCode:1};let{headers:p,data:u,error:f}=await w(a,n);if(f)return f;let l=s.length>0?s:p,h;try{h=new RegExp(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}'
|
|
60
|
+
`,exitCode:1}}let c=u.filter(i=>{let d=l.some(m=>{let g=i[m];return g!=null&&h.test(String(g))});return r?!d:d});return{stdout:v(p,c),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan flatmap: no expression specified
|
|
61
|
+
`,exitCode:1};let{headers:r,data:o,error:a}=await w(s,n);if(a)return a;let u=T(t).map(({expr:c,name:i})=>({alias:typeof i=="string"?i:i[0],ast:A(c)})),f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=[...r,...u.map(c=>c.alias)],h=[];for(let c of o){let i=[],d=1;for(let m of u){let g=O(c,m.ast,f),y=g.length>0&&Array.isArray(g[0])?g[0]:g;i.push(y),d=Math.max(d,y.length)}for(let m=0;m<d;m++){let g={...c};for(let y=0;y<u.length;y++){let x=i[y][m]??null;g[u[y].alias]=x}h.push(g)}}return{stdout:v(l,h),stderr:"",exitCode:0}}async function Me(e,n){let{cmdView:t}=await import("./xan-view-33AU6NPN.js");return t(e,n)}var Ue=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),Qe=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...Ue]),We={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
|
|
62
|
+
It provides a simple, ergonomic interface for common data operations.
|
|
63
|
+
|
|
64
|
+
COMMANDS:
|
|
65
|
+
Core:
|
|
66
|
+
headers Show column names
|
|
67
|
+
count Count rows
|
|
68
|
+
head Show first N rows
|
|
69
|
+
tail Show last N rows
|
|
70
|
+
slice Extract row range
|
|
71
|
+
reverse Reverse row order
|
|
72
|
+
behead Remove header row
|
|
73
|
+
sample Random sample of rows
|
|
74
|
+
|
|
75
|
+
Column operations:
|
|
76
|
+
select Select columns (supports glob, ranges, negation)
|
|
77
|
+
drop Drop columns
|
|
78
|
+
rename Rename columns
|
|
79
|
+
enum Add row index column
|
|
80
|
+
|
|
81
|
+
Row operations:
|
|
82
|
+
filter Filter rows by expression
|
|
83
|
+
search Filter rows by regex match
|
|
84
|
+
sort Sort rows
|
|
85
|
+
dedup Remove duplicates
|
|
86
|
+
top Get top N by column
|
|
87
|
+
|
|
88
|
+
Transformations:
|
|
89
|
+
map Add computed columns
|
|
90
|
+
transform Modify existing columns
|
|
91
|
+
explode Split column into multiple rows
|
|
92
|
+
implode Combine rows, join column values
|
|
93
|
+
flatmap Map returning multiple rows
|
|
94
|
+
pivot Reshape rows into columns
|
|
95
|
+
transpose Swap rows and columns
|
|
96
|
+
|
|
97
|
+
Aggregation:
|
|
98
|
+
agg Aggregate values
|
|
99
|
+
groupby Group and aggregate
|
|
100
|
+
frequency Count value occurrences
|
|
101
|
+
stats Show column statistics
|
|
102
|
+
|
|
103
|
+
Multi-file:
|
|
104
|
+
cat Concatenate CSV files
|
|
105
|
+
join Join two CSV files on key
|
|
106
|
+
merge Merge sorted CSV files
|
|
107
|
+
split Split into multiple files
|
|
108
|
+
partition Split by column value
|
|
109
|
+
|
|
110
|
+
Data conversion:
|
|
111
|
+
to Convert CSV to other formats (json)
|
|
112
|
+
from Convert other formats to CSV (json)
|
|
113
|
+
shuffle Randomly reorder rows
|
|
114
|
+
fixlengths Fix ragged CSV files
|
|
115
|
+
|
|
116
|
+
Output:
|
|
117
|
+
view Pretty print as table
|
|
118
|
+
flatten Display records vertically (alias: f)
|
|
119
|
+
fmt Format output
|
|
120
|
+
|
|
121
|
+
EXAMPLES:
|
|
122
|
+
xan headers data.csv
|
|
123
|
+
xan count data.csv
|
|
124
|
+
xan head -n 5 data.csv
|
|
125
|
+
xan select name,email data.csv
|
|
126
|
+
xan select 'vec_*' data.csv # glob pattern
|
|
127
|
+
xan select 'a:c' data.csv # column range
|
|
128
|
+
xan filter 'age > 30' data.csv
|
|
129
|
+
xan search -r '^foo' data.csv
|
|
130
|
+
xan sort -N price data.csv
|
|
131
|
+
xan agg 'sum(amount) as total' data.csv
|
|
132
|
+
xan groupby region 'count() as n' data.csv
|
|
133
|
+
xan explode tags data.csv
|
|
134
|
+
xan join id file1.csv id file2.csv
|
|
135
|
+
xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},et={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},Gt={name:"xan",async execute(e,n){if(e.length===0||_(e))return $(We);let t=e[0],s=e.slice(1);if(_(s)){let r=et[t];return r?$(r):$(We)}if(Ue.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented
|
|
136
|
+
`,exitCode:1};switch(t){case"headers":return se(s,n);case"count":return re(s,n);case"head":return oe(s,n);case"tail":return ie(s,n);case"slice":return ae(s,n);case"reverse":return le(s,n);case"behead":return Ae(s,n);case"sample":return Le(s,n);case"select":return Q(s,n);case"drop":return ee(s,n);case"rename":return te(s,n);case"enum":return ne(s,n);case"filter":return ye(s,n);case"search":return Pe(s,n);case"sort":return xe(s,n);case"dedup":return we(s,n);case"top":return ve(s,n);case"map":return Ce(s,n);case"transform":return be(s,n);case"explode":return Se(s,n);case"implode":return Ie(s,n);case"flatmap":return Oe(s,n);case"pivot":return Ne(s,n);case"agg":return X(s,n);case"groupby":return Y(s,n);case"frequency":case"freq":return B(s,n);case"stats":return Z(s,n);case"cat":return Fe(s,n);case"join":return ke(s,n);case"merge":return Ee(s,n);case"split":return de(s,n);case"partition":return he(s,n);case"to":return me(s,n);case"from":return ge(s,n);case"transpose":return ce(s,n);case"shuffle":return pe(s,n);case"fixlengths":return fe(s,n);case"view":return J(s,n);case"flatten":case"f":return H(s,n);case"fmt":return Me(s,n);default:return Qe.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
|
|
137
|
+
`,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}'
|
|
138
|
+
Run 'xan --help' for usage.
|
|
139
|
+
`,exitCode:1}}}};export{Gt as xanCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,d as b}from"./chunk-U4UYWYTO.js";import"./chunk-SYMJJMQ4.js";import"./chunk-DXB73IDG.js";export{a as cmdFlatten,b as cmdView};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as b,b as A,c as w}from"./chunk-74CEPOFO.js";import"./chunk-
|
|
1
|
+
import{a as b,b as A,c as w}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var P={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},E={name:"xargs",async execute(n,u){if(A(n))return b(P);let p=null,c=null,l=null,h=!1,x=!1,g=!1,r=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="-I"&&t+1<n.length)p=n[++t],r=t+1;else if(e==="-n"&&t+1<n.length)c=parseInt(n[++t],10),r=t+1;else if(e==="-P"&&t+1<n.length)l=parseInt(n[++t],10),r=t+1;else if(e==="-0"||e==="--null")h=!0,r=t+1;else if(e==="-t"||e==="--verbose")x=!0,r=t+1;else if(e==="-r"||e==="--no-run-if-empty")g=!0,r=t+1;else{if(e.startsWith("--"))return w("xargs",e);if(e.startsWith("-")&&e.length>1){for(let s of e.slice(1))if(!"0tr".includes(s))return w("xargs",`-${s}`);e.includes("0")&&(h=!0),e.includes("t")&&(x=!0),e.includes("r")&&(g=!0),r=t+1}else if(!e.startsWith("-")){r=t;break}}}let o=n.slice(r);o.length===0&&o.push("echo");let I=h?"\0":/\s+/,i=u.stdin.split(I).map(t=>t.trim()).filter(t=>t.length>0);if(i.length===0)return g?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",a="",m=0,C=async t=>{let e=t.join(" ");return x&&(a+=`${e}
|
|
2
2
|
`),u.exec?u.exec(e,{cwd:u.cwd}):{stdout:`${e}
|
|
3
3
|
`,stderr:"",exitCode:0}},y=async t=>{if(l!==null&&l>1)for(let e=0;e<t.length;e+=l){let s=t.slice(e,e+l),N=await Promise.all(s.map(C));for(let f of N)d+=f.stdout,a+=f.stderr,f.exitCode!==0&&(m=f.exitCode)}else for(let e of t){let s=await C(e);d+=s.stdout,a+=s.stderr,s.exitCode!==0&&(m=s.exitCode)}};if(p!==null){let t=i.map(e=>o.map(s=>s.replaceAll(p,e)));await y(t)}else if(c!==null){let t=[];for(let e=0;e<i.length;e+=c){let s=i.slice(e,e+c);t.push([...o,...s])}await y(t)}else{let t=[...o,...i],e=await C(t);d+=e.stdout,a+=e.stderr,m=e.exitCode}return{stdout:d,stderr:a,exitCode:m}}};export{E as xargsCommand};
|