just-bash 1.3.0 → 1.4.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 +3 -3
- package/dist/ast/types.d.ts +2 -0
- package/dist/bin/chunks/hostname-CV7CGKRN.js +3 -0
- package/dist/bin/chunks/od-TXTSFFJY.js +7 -0
- package/dist/bin/chunks/tac-F4GC3MAI.js +9 -0
- package/dist/bin/just-bash.js +125 -115
- package/dist/bin/shell/chunks/hostname-CV7CGKRN.js +3 -0
- package/dist/bin/shell/chunks/od-TXTSFFJY.js +7 -0
- package/dist/bin/shell/chunks/tac-F4GC3MAI.js +9 -0
- package/dist/bin/shell/shell.js +105 -95
- package/dist/bundle/ai/index.js +418 -395
- package/dist/bundle/chunks/hostname-K4BA3P6X.js +2 -0
- package/dist/bundle/chunks/od-SOCTFI2F.js +6 -0
- package/dist/bundle/chunks/tac-VIFKNLII.js +8 -0
- package/dist/bundle/index.js +121 -111
- package/dist/commands/hostname/hostname.d.ts +9 -0
- package/dist/commands/od/od.d.ts +10 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/tac/tac.d.ts +9 -0
- package/dist/interpreter/builtins/index.d.ts +1 -0
- package/dist/interpreter/builtins/mapfile.d.ts +17 -0
- package/dist/interpreter/types.d.ts +6 -0
- package/dist/shell-metadata.d.ts +28 -0
- package/package.json +2 -2
- package/dist/bin/chunks/alias-74DFXE2E.js +0 -7
- package/dist/bin/chunks/awk-S63F6IYK.js +0 -15
- package/dist/bin/chunks/awk2-4DKPX43H.js +0 -20
- package/dist/bin/chunks/awk2-6XCE67AX.js +0 -20
- package/dist/bin/chunks/awk2-DKAZ7LPG.js +0 -20
- package/dist/bin/chunks/awk2-GAJ72X3Z.js +0 -20
- package/dist/bin/chunks/awk2-HJAPWU2N.js +0 -18
- package/dist/bin/chunks/awk2-LVXC5OAC.js +0 -20
- package/dist/bin/chunks/awk2-T6HR4EYO.js +0 -20
- package/dist/bin/chunks/awk2-UYU2UYZ2.js +0 -20
- package/dist/bin/chunks/awk2-W64AZN7P.js +0 -20
- package/dist/bin/chunks/base64-KNBBHA5Y.js +0 -5
- package/dist/bin/chunks/base64-NC7HTKLZ.js +0 -5
- package/dist/bin/chunks/basename-Y7JDBYHN.js +0 -6
- package/dist/bin/chunks/bash-5IWSVGHN.js +0 -7
- package/dist/bin/chunks/bash-TQGTNXAE.js +0 -7
- package/dist/bin/chunks/cat-YZXBF5YF.js +0 -6
- package/dist/bin/chunks/chmod-3G4LK462.js +0 -9
- package/dist/bin/chunks/chunk-5KNEBKYN.js +0 -2
- package/dist/bin/chunks/chunk-6QUZ7QML.js +0 -3
- package/dist/bin/chunks/chunk-7Q4WQLOS.js +0 -9
- package/dist/bin/chunks/chunk-LV662IGP.js +0 -6
- package/dist/bin/chunks/clear-GTCFHSB2.js +0 -2
- package/dist/bin/chunks/cp-77UY7PGN.js +0 -8
- package/dist/bin/chunks/curl-NE7XEWMN.js +0 -26
- package/dist/bin/chunks/cut-UYV3FM7R.js +0 -6
- package/dist/bin/chunks/date-7NBRXV2Z.js +0 -5
- package/dist/bin/chunks/diff-TG2NXCX2.js +0 -19
- package/dist/bin/chunks/dirname-VLHP44TU.js +0 -5
- package/dist/bin/chunks/du-4FZ7WF2P.js +0 -8
- package/dist/bin/chunks/echo-DEUIS5JO.js +0 -4
- package/dist/bin/chunks/env-AKGX6HSG.js +0 -9
- package/dist/bin/chunks/env-FVITWNHG.js +0 -9
- package/dist/bin/chunks/expr-HA2ZNL6S.js +0 -5
- package/dist/bin/chunks/file-Q4UOC4J2.js +0 -23
- package/dist/bin/chunks/find-4B67H4RP.js +0 -11
- package/dist/bin/chunks/find-7BUNQZX4.js +0 -11
- package/dist/bin/chunks/find-AMA6ABN5.js +0 -11
- package/dist/bin/chunks/find-HW2TUO6B.js +0 -11
- package/dist/bin/chunks/find-JADNFF7V.js +0 -11
- package/dist/bin/chunks/find-NCI6KGUI.js +0 -11
- package/dist/bin/chunks/find-QEYP42JQ.js +0 -11
- package/dist/bin/chunks/find-WJV3FM6L.js +0 -11
- package/dist/bin/chunks/find-YATLECXJ.js +0 -11
- package/dist/bin/chunks/grep-OVWU4WCZ.js +0 -15
- package/dist/bin/chunks/grep-PHBFGJCV.js +0 -15
- package/dist/bin/chunks/head-VGXR3WWL.js +0 -2
- package/dist/bin/chunks/help-5V3MPCYQ.js +0 -16
- package/dist/bin/chunks/help-YQGNAT2T.js +0 -16
- package/dist/bin/chunks/history-PRQ4B6N2.js +0 -3
- package/dist/bin/chunks/html-to-markdown-L4UWMK4S.js +0 -84
- package/dist/bin/chunks/jq-EYSXBSCP.js +0 -14
- package/dist/bin/chunks/ln-DB7J2W5X.js +0 -10
- package/dist/bin/chunks/ls-C4MPAF3H.js +0 -26
- package/dist/bin/chunks/md5sum-KZ4MRIXM.js +0 -2
- package/dist/bin/chunks/mkdir-LWULWDHP.js +0 -7
- package/dist/bin/chunks/mv-TDYCNSIQ.js +0 -7
- package/dist/bin/chunks/paste-R36J3G4K.js +0 -8
- package/dist/bin/chunks/printf-ASOYDPIK.js +0 -14
- package/dist/bin/chunks/printf-BOFQVMMK.js +0 -15
- package/dist/bin/chunks/printf-WM4X6IZ6.js +0 -14
- package/dist/bin/chunks/pwd-X4MWD4JP.js +0 -3
- package/dist/bin/chunks/readlink-DPNOQY67.js +0 -7
- package/dist/bin/chunks/rm-W6CCBEMG.js +0 -8
- package/dist/bin/chunks/sed-7IS44XON.js +0 -48
- package/dist/bin/chunks/sed-B6FXUN7R.js +0 -80
- package/dist/bin/chunks/sed-LTCVBSRV.js +0 -80
- package/dist/bin/chunks/sed-RHLDIXPL.js +0 -76
- package/dist/bin/chunks/sed-SYSATJXR.js +0 -75
- package/dist/bin/chunks/seq-DGJILX2Q.js +0 -7
- package/dist/bin/chunks/sha1sum-XLRE72T4.js +0 -2
- package/dist/bin/chunks/sha256sum-BBKWFA43.js +0 -2
- package/dist/bin/chunks/sleep-E4DIYGTT.js +0 -10
- package/dist/bin/chunks/sort-NCQNGVCX.js +0 -16
- package/dist/bin/chunks/sort-UJP353TM.js +0 -15
- package/dist/bin/chunks/sort-WGKQ3WYR.js +0 -15
- package/dist/bin/chunks/stat-3PHITCPO.js +0 -9
- package/dist/bin/chunks/tail-YSVKBQ77.js +0 -2
- package/dist/bin/chunks/tee-UU2VS3OM.js +0 -3
- package/dist/bin/chunks/timeout-OZVAGW2H.js +0 -12
- package/dist/bin/chunks/timeout-RP2AJGMV.js +0 -12
- package/dist/bin/chunks/touch-XCIAYF5I.js +0 -4
- package/dist/bin/chunks/tr-2EEKHHO6.js +0 -20
- package/dist/bin/chunks/tree-4247W67O.js +0 -12
- package/dist/bin/chunks/true-JCX733LK.js +0 -2
- package/dist/bin/chunks/uniq-W4HF6YSB.js +0 -5
- package/dist/bin/chunks/wc-CNJ3QDRA.js +0 -6
- package/dist/bin/chunks/which-HX2NMOP3.js +0 -3
- package/dist/bin/chunks/xargs-DKUAYNEK.js +0 -4
- package/dist/bin/chunks/xargs-XAZFX5J3.js +0 -4
- package/dist/bin/chunks/xargs-YNLVLPOF.js +0 -4
- package/dist/bin/shell/chunks/alias-74DFXE2E.js +0 -7
- package/dist/bin/shell/chunks/awk-S63F6IYK.js +0 -15
- package/dist/bin/shell/chunks/awk2-4DKPX43H.js +0 -20
- package/dist/bin/shell/chunks/awk2-6XCE67AX.js +0 -20
- package/dist/bin/shell/chunks/awk2-DKAZ7LPG.js +0 -20
- package/dist/bin/shell/chunks/awk2-GAJ72X3Z.js +0 -20
- package/dist/bin/shell/chunks/awk2-HJAPWU2N.js +0 -18
- package/dist/bin/shell/chunks/awk2-LVXC5OAC.js +0 -20
- package/dist/bin/shell/chunks/awk2-T6HR4EYO.js +0 -20
- package/dist/bin/shell/chunks/awk2-UYU2UYZ2.js +0 -20
- package/dist/bin/shell/chunks/awk2-W64AZN7P.js +0 -20
- package/dist/bin/shell/chunks/base64-KNBBHA5Y.js +0 -5
- package/dist/bin/shell/chunks/base64-NC7HTKLZ.js +0 -5
- package/dist/bin/shell/chunks/basename-Y7JDBYHN.js +0 -6
- package/dist/bin/shell/chunks/bash-5IWSVGHN.js +0 -7
- package/dist/bin/shell/chunks/bash-TQGTNXAE.js +0 -7
- package/dist/bin/shell/chunks/cat-YZXBF5YF.js +0 -6
- package/dist/bin/shell/chunks/chmod-3G4LK462.js +0 -9
- package/dist/bin/shell/chunks/chunk-5KNEBKYN.js +0 -2
- package/dist/bin/shell/chunks/chunk-6QUZ7QML.js +0 -3
- package/dist/bin/shell/chunks/chunk-7Q4WQLOS.js +0 -9
- package/dist/bin/shell/chunks/chunk-LV662IGP.js +0 -6
- package/dist/bin/shell/chunks/clear-GTCFHSB2.js +0 -2
- package/dist/bin/shell/chunks/cp-77UY7PGN.js +0 -8
- package/dist/bin/shell/chunks/curl-NE7XEWMN.js +0 -26
- package/dist/bin/shell/chunks/cut-UYV3FM7R.js +0 -6
- package/dist/bin/shell/chunks/date-7NBRXV2Z.js +0 -5
- package/dist/bin/shell/chunks/diff-TG2NXCX2.js +0 -19
- package/dist/bin/shell/chunks/dirname-VLHP44TU.js +0 -5
- package/dist/bin/shell/chunks/du-4FZ7WF2P.js +0 -8
- package/dist/bin/shell/chunks/echo-DEUIS5JO.js +0 -4
- package/dist/bin/shell/chunks/env-AKGX6HSG.js +0 -9
- package/dist/bin/shell/chunks/env-FVITWNHG.js +0 -9
- package/dist/bin/shell/chunks/expr-HA2ZNL6S.js +0 -5
- package/dist/bin/shell/chunks/file-Q4UOC4J2.js +0 -23
- package/dist/bin/shell/chunks/find-4B67H4RP.js +0 -11
- package/dist/bin/shell/chunks/find-7BUNQZX4.js +0 -11
- package/dist/bin/shell/chunks/find-AMA6ABN5.js +0 -11
- package/dist/bin/shell/chunks/find-HW2TUO6B.js +0 -11
- package/dist/bin/shell/chunks/find-JADNFF7V.js +0 -11
- package/dist/bin/shell/chunks/find-NCI6KGUI.js +0 -11
- package/dist/bin/shell/chunks/find-QEYP42JQ.js +0 -11
- package/dist/bin/shell/chunks/find-WJV3FM6L.js +0 -11
- package/dist/bin/shell/chunks/find-YATLECXJ.js +0 -11
- package/dist/bin/shell/chunks/grep-OVWU4WCZ.js +0 -15
- package/dist/bin/shell/chunks/grep-PHBFGJCV.js +0 -15
- package/dist/bin/shell/chunks/head-VGXR3WWL.js +0 -2
- package/dist/bin/shell/chunks/help-5V3MPCYQ.js +0 -16
- package/dist/bin/shell/chunks/help-YQGNAT2T.js +0 -16
- package/dist/bin/shell/chunks/history-PRQ4B6N2.js +0 -3
- package/dist/bin/shell/chunks/html-to-markdown-L4UWMK4S.js +0 -84
- package/dist/bin/shell/chunks/jq-EYSXBSCP.js +0 -14
- package/dist/bin/shell/chunks/ln-DB7J2W5X.js +0 -10
- package/dist/bin/shell/chunks/ls-C4MPAF3H.js +0 -26
- package/dist/bin/shell/chunks/md5sum-KZ4MRIXM.js +0 -2
- package/dist/bin/shell/chunks/mkdir-LWULWDHP.js +0 -7
- package/dist/bin/shell/chunks/mv-TDYCNSIQ.js +0 -7
- package/dist/bin/shell/chunks/paste-R36J3G4K.js +0 -8
- package/dist/bin/shell/chunks/printf-ASOYDPIK.js +0 -14
- package/dist/bin/shell/chunks/printf-BOFQVMMK.js +0 -15
- package/dist/bin/shell/chunks/printf-WM4X6IZ6.js +0 -14
- package/dist/bin/shell/chunks/pwd-X4MWD4JP.js +0 -3
- package/dist/bin/shell/chunks/readlink-DPNOQY67.js +0 -7
- package/dist/bin/shell/chunks/rm-W6CCBEMG.js +0 -8
- package/dist/bin/shell/chunks/sed-7IS44XON.js +0 -48
- package/dist/bin/shell/chunks/sed-B6FXUN7R.js +0 -80
- package/dist/bin/shell/chunks/sed-LTCVBSRV.js +0 -80
- package/dist/bin/shell/chunks/sed-RHLDIXPL.js +0 -76
- package/dist/bin/shell/chunks/sed-SYSATJXR.js +0 -75
- package/dist/bin/shell/chunks/seq-DGJILX2Q.js +0 -7
- package/dist/bin/shell/chunks/sha1sum-XLRE72T4.js +0 -2
- package/dist/bin/shell/chunks/sha256sum-BBKWFA43.js +0 -2
- package/dist/bin/shell/chunks/sleep-E4DIYGTT.js +0 -10
- package/dist/bin/shell/chunks/sort-NCQNGVCX.js +0 -16
- package/dist/bin/shell/chunks/sort-UJP353TM.js +0 -15
- package/dist/bin/shell/chunks/sort-WGKQ3WYR.js +0 -15
- package/dist/bin/shell/chunks/stat-3PHITCPO.js +0 -9
- package/dist/bin/shell/chunks/tail-YSVKBQ77.js +0 -2
- package/dist/bin/shell/chunks/tee-UU2VS3OM.js +0 -3
- package/dist/bin/shell/chunks/timeout-OZVAGW2H.js +0 -12
- package/dist/bin/shell/chunks/timeout-RP2AJGMV.js +0 -12
- package/dist/bin/shell/chunks/touch-XCIAYF5I.js +0 -4
- package/dist/bin/shell/chunks/tr-2EEKHHO6.js +0 -20
- package/dist/bin/shell/chunks/tree-4247W67O.js +0 -12
- package/dist/bin/shell/chunks/true-JCX733LK.js +0 -2
- package/dist/bin/shell/chunks/uniq-W4HF6YSB.js +0 -5
- package/dist/bin/shell/chunks/wc-CNJ3QDRA.js +0 -6
- package/dist/bin/shell/chunks/which-HX2NMOP3.js +0 -3
- package/dist/bin/shell/chunks/xargs-DKUAYNEK.js +0 -4
- package/dist/bin/shell/chunks/xargs-XAZFX5J3.js +0 -4
- package/dist/bin/shell/chunks/xargs-YNLVLPOF.js +0 -4
- package/dist/bundle/chunks/alias-7ZSTROM7.js +0 -6
- package/dist/bundle/chunks/awk-V4C3GTJI.js +0 -14
- package/dist/bundle/chunks/awk2-365HINHI.js +0 -19
- package/dist/bundle/chunks/awk2-4YCQ6UCB.js +0 -19
- package/dist/bundle/chunks/awk2-7YCFY7D2.js +0 -19
- package/dist/bundle/chunks/awk2-7YL3P4KU.js +0 -19
- package/dist/bundle/chunks/awk2-ETXZHQQ4.js +0 -19
- package/dist/bundle/chunks/awk2-FMEL7ESV.js +0 -19
- package/dist/bundle/chunks/awk2-LE4QUFGK.js +0 -19
- package/dist/bundle/chunks/awk2-MGHA6JPJ.js +0 -17
- package/dist/bundle/chunks/awk2-XEAK5PBN.js +0 -19
- package/dist/bundle/chunks/base64-JN6XXTIG.js +0 -4
- package/dist/bundle/chunks/base64-WATI5PWI.js +0 -4
- package/dist/bundle/chunks/basename-SB5JXIY3.js +0 -5
- package/dist/bundle/chunks/bash-5WG5RD6L.js +0 -6
- package/dist/bundle/chunks/bash-T4PXVRYX.js +0 -6
- package/dist/bundle/chunks/cat-5KESXK2M.js +0 -5
- package/dist/bundle/chunks/chmod-VLKWIL3N.js +0 -8
- package/dist/bundle/chunks/chunk-4HEWHW5W.js +0 -8
- package/dist/bundle/chunks/chunk-JYYFSUWP.js +0 -5
- package/dist/bundle/chunks/chunk-TDJNT32M.js +0 -2
- package/dist/bundle/chunks/clear-ZBD2DMXN.js +0 -1
- package/dist/bundle/chunks/cp-BLHAPLQZ.js +0 -7
- package/dist/bundle/chunks/curl-PA2MWGKN.js +0 -25
- package/dist/bundle/chunks/cut-7RHEYJ7Y.js +0 -5
- package/dist/bundle/chunks/date-YOOSNZVA.js +0 -4
- package/dist/bundle/chunks/diff-IVJFQANX.js +0 -6
- package/dist/bundle/chunks/dirname-Q5HDZLH2.js +0 -4
- package/dist/bundle/chunks/du-I5HYAKTQ.js +0 -7
- package/dist/bundle/chunks/echo-W2TA2N7Y.js +0 -3
- package/dist/bundle/chunks/env-2F2VHNYS.js +0 -8
- package/dist/bundle/chunks/env-OORA5GFS.js +0 -8
- package/dist/bundle/chunks/expr-A4LJAGVP.js +0 -4
- package/dist/bundle/chunks/file-JMDIXLHY.js +0 -22
- package/dist/bundle/chunks/find-3O5V74IR.js +0 -10
- package/dist/bundle/chunks/find-4QUN2ATO.js +0 -10
- package/dist/bundle/chunks/find-522XP4ZY.js +0 -10
- package/dist/bundle/chunks/find-5UN24ZV7.js +0 -10
- package/dist/bundle/chunks/find-JXG2HF6L.js +0 -10
- package/dist/bundle/chunks/find-K3NO35MZ.js +0 -10
- package/dist/bundle/chunks/find-K7D4PKHS.js +0 -10
- package/dist/bundle/chunks/find-KP4M5DWC.js +0 -10
- package/dist/bundle/chunks/find-WM6ZETA7.js +0 -10
- package/dist/bundle/chunks/grep-3D2INI4S.js +0 -14
- package/dist/bundle/chunks/grep-CZTYKNEE.js +0 -14
- package/dist/bundle/chunks/head-7H5R4WKO.js +0 -1
- package/dist/bundle/chunks/help-SDCRRU2F.js +0 -15
- package/dist/bundle/chunks/help-XHGUXTV3.js +0 -15
- package/dist/bundle/chunks/history-7Z2STZ6Y.js +0 -2
- package/dist/bundle/chunks/html-to-markdown-XMBYO6FD.js +0 -4
- package/dist/bundle/chunks/jq-7R2XGLLH.js +0 -13
- package/dist/bundle/chunks/ln-UTUVIAFP.js +0 -9
- package/dist/bundle/chunks/ls-B7C35UDO.js +0 -23
- package/dist/bundle/chunks/md5sum-3BXZVFKC.js +0 -1
- package/dist/bundle/chunks/mkdir-WYI2LJ6H.js +0 -6
- package/dist/bundle/chunks/mv-GN23UIZU.js +0 -6
- package/dist/bundle/chunks/paste-L4TYPVSP.js +0 -7
- package/dist/bundle/chunks/printf-3ZT5XOIZ.js +0 -14
- package/dist/bundle/chunks/printf-G2SBUNW3.js +0 -13
- package/dist/bundle/chunks/printf-O2UW73XK.js +0 -13
- package/dist/bundle/chunks/pwd-ZVX5RTL4.js +0 -2
- package/dist/bundle/chunks/readlink-HHC33N5C.js +0 -6
- package/dist/bundle/chunks/rm-5X2XSQQ6.js +0 -7
- package/dist/bundle/chunks/sed-2WWCANZT.js +0 -79
- package/dist/bundle/chunks/sed-5LZHAGFR.js +0 -74
- package/dist/bundle/chunks/sed-IGVS3UIY.js +0 -79
- package/dist/bundle/chunks/sed-UZJSXYQZ.js +0 -47
- package/dist/bundle/chunks/sed-V7XSBPTD.js +0 -75
- package/dist/bundle/chunks/seq-TFPZQZPJ.js +0 -6
- package/dist/bundle/chunks/sha1sum-MSBXCB4N.js +0 -1
- package/dist/bundle/chunks/sha256sum-YMKJMSTW.js +0 -1
- package/dist/bundle/chunks/sleep-QJBQD6VS.js +0 -9
- package/dist/bundle/chunks/sort-LHMQWYH2.js +0 -14
- package/dist/bundle/chunks/sort-R3YWDMTV.js +0 -14
- package/dist/bundle/chunks/sort-TEXV7CUR.js +0 -15
- package/dist/bundle/chunks/stat-TM5F5YO4.js +0 -8
- package/dist/bundle/chunks/tail-BLGGG2VX.js +0 -1
- package/dist/bundle/chunks/tee-VCNOG5VI.js +0 -2
- package/dist/bundle/chunks/timeout-THAT7IOO.js +0 -11
- package/dist/bundle/chunks/timeout-VG2N46UR.js +0 -11
- package/dist/bundle/chunks/touch-Z5XRYFYY.js +0 -3
- package/dist/bundle/chunks/tr-UV4V27RJ.js +0 -19
- package/dist/bundle/chunks/tree-75UXQ4XJ.js +0 -11
- package/dist/bundle/chunks/true-OD7ZXH3O.js +0 -1
- package/dist/bundle/chunks/uniq-IIOQKNTS.js +0 -4
- package/dist/bundle/chunks/wc-OXLYBRUE.js +0 -5
- package/dist/bundle/chunks/which-ONWH3TNF.js +0 -2
- package/dist/bundle/chunks/xargs-752VENJT.js +0 -3
- package/dist/bundle/chunks/xargs-7KV5F66T.js +0 -3
- package/dist/bundle/chunks/xargs-E5JPQL24.js +0 -3
- package/dist/commands/awk/awk.d.ts +0 -2
- package/dist/commands/awk/executor.d.ts +0 -3
- package/dist/commands/awk/expressions.d.ts +0 -3
- package/dist/commands/awk/functions.d.ts +0 -12
- package/dist/commands/awk/interpreter2.d.ts +0 -90
- package/dist/commands/awk/parser.d.ts +0 -3
- package/dist/commands/awk/types.d.ts +0 -44
- package/dist/fs-interface.d.ts +0 -186
- package/dist/fs.d.ts +0 -39
- package/dist/overlay-fs/OverlayFs.d.ts +0 -87
- package/dist/overlay-fs/index.d.ts +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-4HEWHW5W.js";import"./chunk-74CEPOFO.js";import"./chunk-2RUN43TJ.js";var e=m("sha256sum","sha256","compute SHA256 message digest");export{e as sha256sumCommand};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{a,b as o}from"./chunk-74CEPOFO.js";var i={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
|
|
2
|
-
s - seconds (default)
|
|
3
|
-
m - minutes
|
|
4
|
-
h - hours
|
|
5
|
-
d - days
|
|
6
|
-
|
|
7
|
-
NUMBER may be a decimal number.`,options:[" --help display this help and exit"]};function l(t){let s=t.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!s)return null;let e=parseFloat(s[1]);switch(s[2]||"s"){case"s":return e*1e3;case"m":return e*60*1e3;case"h":return e*60*60*1e3;case"d":return e*24*60*60*1e3;default:return null}}var d={name:"sleep",async execute(t,s){if(o(t))return a(i);if(t.length===0)return{stdout:"",stderr:`sleep: missing operand
|
|
8
|
-
`,exitCode:1};let e=0;for(let n of t){let r=l(n);if(r===null)return{stdout:"",stderr:`sleep: invalid time interval '${n}'
|
|
9
|
-
`,exitCode:1};e+=r}return s.sleep?await s.sleep(e):await new Promise(n=>setTimeout(n,e)),{stdout:"",stderr:"",exitCode:0}}};export{d as sleepCommand};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{b as F}from"./chunk-3YNHMZ5M.js";import{a as v,b as y,c as C}from"./chunk-74CEPOFO.js";function k(u,t,r){let f=r!==null?r:/\s+/,a=u.split(f),s=t.startField-1;if(s>=a.length)return"";if(t.endField===void 0){let i=a[s]||"";return t.startChar!==void 0&&(i=i.slice(t.startChar-1)),t.ignoreLeading&&(i=i.trimStart()),i}let l=Math.min(t.endField-1,a.length-1),c="";for(let i=s;i<=l&&i<a.length;i++){let o=a[i]||"";if(i===s&&t.startChar!==void 0&&(o=o.slice(t.startChar-1)),i===l&&t.endChar!==void 0){let e=i===s&&t.startChar!==void 0?t.endChar-t.startChar+1:t.endChar;o=o.slice(0,e)}i>s&&(c+=r||" "),c+=o}return t.ignoreLeading&&(c=c.trimStart()),c}function S(u,t,r,f){if(r){let l=parseFloat(u)||0,c=parseFloat(t)||0;return l-c}let a=u,s=t;return f&&(a=a.toLowerCase(),s=s.toLowerCase()),a.localeCompare(s)}function b(u){let{keys:t,fieldDelimiter:r,numeric:f,ignoreCase:a,reverse:s}=u;return(l,c)=>{if(t.length===0){let o=l,e=c;a&&(o=o.toLowerCase(),e=e.toLowerCase());let n;if(f){let d=parseFloat(o)||0,h=parseFloat(e)||0;if(n=d-h,n===0){let p=o.localeCompare(e);return s?-p:p}}else n=o.localeCompare(e);return s?-n:n}for(let o of t){let e=k(l,o,r),n=k(c,o,r),d=o.numeric??f,h=o.ignoreCase??a,p=o.reverse??s,g=S(e,n,d,h);if(g!==0)return p?-g:g}let i=l.localeCompare(c);return s?-i:i}}function w(u,t){if(t.keys.length===0){if(t.ignoreCase){let a=new Set;return u.filter(s=>{let l=s.toLowerCase();return a.has(l)?!1:(a.add(l),!0)})}return[...new Set(u)]}let r=t.keys[0],f=new Set;return u.filter(a=>{let s=k(a,r,t.fieldDelimiter);return(r.ignoreCase??t.ignoreCase)&&(s=s.toLowerCase()),f.has(s)?!1:(f.add(s),!0)})}function m(u){let t={startField:1},r="",f=u,a=f.match(/([nrfb]+)$/i);a&&(r=a[1].toLowerCase(),f=f.slice(0,-r.length)),r.includes("n")&&(t.numeric=!0),r.includes("r")&&(t.reverse=!0),r.includes("f")&&(t.ignoreCase=!0),r.includes("b")&&(t.ignoreLeading=!0);let s=f.split(",");if(s.length===0||s[0]==="")return null;let l=s[0].split("."),c=parseInt(l[0],10);if(Number.isNaN(c)||c<1)return null;if(t.startField=c,l.length>1&&l[1]){let i=parseInt(l[1],10);!Number.isNaN(i)&&i>=1&&(t.startChar=i)}if(s.length>1&&s[1]){let i=s[1],o=i.match(/([nrfb]+)$/i);if(o){let n=o[1].toLowerCase();n.includes("n")&&(t.numeric=!0),n.includes("r")&&(t.reverse=!0),n.includes("f")&&(t.ignoreCase=!0),n.includes("b")&&(t.ignoreLeading=!0),i=i.slice(0,-n.length)}let e=i.split(".");if(e[0]){let n=parseInt(e[0],10);if(!Number.isNaN(n)&&n>=1&&(t.endField=n),e.length>1&&e[1]){let d=parseInt(e[1],10);!Number.isNaN(d)&&d>=1&&(t.endChar=d)}}}return t}var N={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-f, --ignore-case fold lower case to upper case characters","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
|
|
2
|
-
F is a field number (1-indexed)
|
|
3
|
-
C is a character position within the field (1-indexed)
|
|
4
|
-
OPTS can be: n (numeric), r (reverse), f (fold case), b (ignore blanks)
|
|
5
|
-
|
|
6
|
-
Examples:
|
|
7
|
-
-k1 sort by first field
|
|
8
|
-
-k2,2 sort by second field only
|
|
9
|
-
-k1.3 sort by first field starting at 3rd character
|
|
10
|
-
-k1,2n sort by fields 1-2 numerically
|
|
11
|
-
-k2 -k1 sort by field 2, then by field 1`},D={name:"sort",async execute(u,t){if(y(u))return v(N);let r={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,keys:[],fieldDelimiter:null},f=[];for(let o=0;o<u.length;o++){let e=u[o];if(e==="-r"||e==="--reverse")r.reverse=!0;else if(e==="-n"||e==="--numeric-sort")r.numeric=!0;else if(e==="-u"||e==="--unique")r.unique=!0;else if(e==="-f"||e==="--ignore-case")r.ignoreCase=!0;else if(e==="-t"||e==="--field-separator")r.fieldDelimiter=u[++o]||null;else if(e.startsWith("-t"))r.fieldDelimiter=e.slice(2)||null;else if(e.startsWith("--field-separator="))r.fieldDelimiter=e.slice(18)||null;else if(e==="-k"||e==="--key"){let n=u[++o];if(n){let d=m(n);d&&r.keys.push(d)}}else if(e.startsWith("-k")){let n=m(e.slice(2));n&&r.keys.push(n)}else if(e.startsWith("--key=")){let n=m(e.slice(6));n&&r.keys.push(n)}else{if(e.startsWith("--"))return C("sort",e);if(e.startsWith("-")&&!e.startsWith("--")){let n=!1;for(let d of e.slice(1))if(d==="r")r.reverse=!0;else if(d==="n")r.numeric=!0;else if(d==="u")r.unique=!0;else if(d==="f")r.ignoreCase=!0;else{n=!0;break}if(n)return C("sort",e)}else f.push(e)}}let a=await F(t,f,{cmdName:"sort"});if(!a.ok)return a.error;let l=a.content.split(`
|
|
12
|
-
`);l.length>0&&l[l.length-1]===""&&l.pop();let c=b(r);return l.sort(c),r.unique&&(l=w(l,r)),{stdout:l.length>0?`${l.join(`
|
|
13
|
-
`)}
|
|
14
|
-
`:"",stderr:"",exitCode:0}}};export{D as sortCommand};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{b as F}from"./chunk-3YNHMZ5M.js";import{a as v,b as y,c as C}from"./chunk-74CEPOFO.js";import"./chunk-2RUN43TJ.js";function k(u,t,r){let f=r!==null?r:/\s+/,a=u.split(f),s=t.startField-1;if(s>=a.length)return"";if(t.endField===void 0){let i=a[s]||"";return t.startChar!==void 0&&(i=i.slice(t.startChar-1)),t.ignoreLeading&&(i=i.trimStart()),i}let l=Math.min(t.endField-1,a.length-1),c="";for(let i=s;i<=l&&i<a.length;i++){let o=a[i]||"";if(i===s&&t.startChar!==void 0&&(o=o.slice(t.startChar-1)),i===l&&t.endChar!==void 0){let e=i===s&&t.startChar!==void 0?t.endChar-t.startChar+1:t.endChar;o=o.slice(0,e)}i>s&&(c+=r||" "),c+=o}return t.ignoreLeading&&(c=c.trimStart()),c}function S(u,t,r,f){if(r){let l=parseFloat(u)||0,c=parseFloat(t)||0;return l-c}let a=u,s=t;return f&&(a=a.toLowerCase(),s=s.toLowerCase()),a.localeCompare(s)}function b(u){let{keys:t,fieldDelimiter:r,numeric:f,ignoreCase:a,reverse:s}=u;return(l,c)=>{if(t.length===0){let o=l,e=c;a&&(o=o.toLowerCase(),e=e.toLowerCase());let n;if(f){let d=parseFloat(o)||0,h=parseFloat(e)||0;if(n=d-h,n===0){let p=o.localeCompare(e);return s?-p:p}}else n=o.localeCompare(e);return s?-n:n}for(let o of t){let e=k(l,o,r),n=k(c,o,r),d=o.numeric??f,h=o.ignoreCase??a,p=o.reverse??s,g=S(e,n,d,h);if(g!==0)return p?-g:g}let i=l.localeCompare(c);return s?-i:i}}function w(u,t){if(t.keys.length===0){if(t.ignoreCase){let a=new Set;return u.filter(s=>{let l=s.toLowerCase();return a.has(l)?!1:(a.add(l),!0)})}return[...new Set(u)]}let r=t.keys[0],f=new Set;return u.filter(a=>{let s=k(a,r,t.fieldDelimiter);return(r.ignoreCase??t.ignoreCase)&&(s=s.toLowerCase()),f.has(s)?!1:(f.add(s),!0)})}function m(u){let t={startField:1},r="",f=u,a=f.match(/([nrfb]+)$/i);a&&(r=a[1].toLowerCase(),f=f.slice(0,-r.length)),r.includes("n")&&(t.numeric=!0),r.includes("r")&&(t.reverse=!0),r.includes("f")&&(t.ignoreCase=!0),r.includes("b")&&(t.ignoreLeading=!0);let s=f.split(",");if(s.length===0||s[0]==="")return null;let l=s[0].split("."),c=parseInt(l[0],10);if(Number.isNaN(c)||c<1)return null;if(t.startField=c,l.length>1&&l[1]){let i=parseInt(l[1],10);!Number.isNaN(i)&&i>=1&&(t.startChar=i)}if(s.length>1&&s[1]){let i=s[1],o=i.match(/([nrfb]+)$/i);if(o){let n=o[1].toLowerCase();n.includes("n")&&(t.numeric=!0),n.includes("r")&&(t.reverse=!0),n.includes("f")&&(t.ignoreCase=!0),n.includes("b")&&(t.ignoreLeading=!0),i=i.slice(0,-n.length)}let e=i.split(".");if(e[0]){let n=parseInt(e[0],10);if(!Number.isNaN(n)&&n>=1&&(t.endField=n),e.length>1&&e[1]){let d=parseInt(e[1],10);!Number.isNaN(d)&&d>=1&&(t.endChar=d)}}}return t}var N={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-f, --ignore-case fold lower case to upper case characters","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
|
|
2
|
-
F is a field number (1-indexed)
|
|
3
|
-
C is a character position within the field (1-indexed)
|
|
4
|
-
OPTS can be: n (numeric), r (reverse), f (fold case), b (ignore blanks)
|
|
5
|
-
|
|
6
|
-
Examples:
|
|
7
|
-
-k1 sort by first field
|
|
8
|
-
-k2,2 sort by second field only
|
|
9
|
-
-k1.3 sort by first field starting at 3rd character
|
|
10
|
-
-k1,2n sort by fields 1-2 numerically
|
|
11
|
-
-k2 -k1 sort by field 2, then by field 1`},D={name:"sort",async execute(u,t){if(y(u))return v(N);let r={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,keys:[],fieldDelimiter:null},f=[];for(let o=0;o<u.length;o++){let e=u[o];if(e==="-r"||e==="--reverse")r.reverse=!0;else if(e==="-n"||e==="--numeric-sort")r.numeric=!0;else if(e==="-u"||e==="--unique")r.unique=!0;else if(e==="-f"||e==="--ignore-case")r.ignoreCase=!0;else if(e==="-t"||e==="--field-separator")r.fieldDelimiter=u[++o]||null;else if(e.startsWith("-t"))r.fieldDelimiter=e.slice(2)||null;else if(e.startsWith("--field-separator="))r.fieldDelimiter=e.slice(18)||null;else if(e==="-k"||e==="--key"){let n=u[++o];if(n){let d=m(n);d&&r.keys.push(d)}}else if(e.startsWith("-k")){let n=m(e.slice(2));n&&r.keys.push(n)}else if(e.startsWith("--key=")){let n=m(e.slice(6));n&&r.keys.push(n)}else{if(e.startsWith("--"))return C("sort",e);if(e.startsWith("-")&&!e.startsWith("--")){let n=!1;for(let d of e.slice(1))if(d==="r")r.reverse=!0;else if(d==="n")r.numeric=!0;else if(d==="u")r.unique=!0;else if(d==="f")r.ignoreCase=!0;else{n=!0;break}if(n)return C("sort",e)}else f.push(e)}}let a=await F(t,f,{cmdName:"sort"});if(!a.ok)return a.error;let l=a.content.split(`
|
|
12
|
-
`);l.length>0&&l[l.length-1]===""&&l.pop();let c=b(r);return l.sort(c),r.unique&&(l=w(l,r)),{stdout:l.length>0?`${l.join(`
|
|
13
|
-
`)}
|
|
14
|
-
`:"",stderr:"",exitCode:0}}};export{D as sortCommand};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{b as O}from"./chunk-3YNHMZ5M.js";import{a as F,b as N,c as k}from"./chunk-74CEPOFO.js";import"./chunk-2RUN43TJ.js";var P={"":1,k:1024,m:1048576,g:1073741824,t:1099511627776,p:0x4000000000000,e:1152921504606847e3},V={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12};function w(c){let t=c.trim(),e=t.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!e){let n=parseFloat(t);return Number.isNaN(n)?0:n}let a=parseFloat(e[1]),s=(e[2]||"").toLowerCase(),i=P[s]||1;return a*i}function L(c){let t=c.trim().toLowerCase().slice(0,3);return V[t]||0}function D(c,t){let e=c.split(/(\d+)/),a=t.split(/(\d+)/),s=Math.max(e.length,a.length);for(let i=0;i<s;i++){let n=e[i]||"",d=a[i]||"",o=/^\d+$/.test(n)?parseInt(n,10):null,l=/^\d+$/.test(d)?parseInt(d,10):null;if(o!==null&&l!==null){if(o!==l)return o-l}else if(n!==d)return n.localeCompare(d)}return 0}function x(c){return c.replace(/[^a-zA-Z0-9\s]/g,"")}function v(c,t,e){let a=e!==null?e:/\s+/,s=c.split(a),i=t.startField-1;if(i>=s.length)return"";if(t.endField===void 0){let o=s[i]||"";return t.startChar!==void 0&&(o=o.slice(t.startChar-1)),t.ignoreLeading&&(o=o.trimStart()),o}let n=Math.min(t.endField-1,s.length-1),d="";for(let o=i;o<=n&&o<s.length;o++){let l=s[o]||"";if(o===i&&t.startChar!==void 0&&(l=l.slice(t.startChar-1)),o===n&&t.endChar!==void 0){let r=o===i&&t.startChar!==void 0?t.endChar-t.startChar+1:t.endChar;l=l.slice(0,r)}o>i&&(d+=e||" "),d+=l}return t.ignoreLeading&&(d=d.trimStart()),d}function I(c,t,e){let a=c,s=t;if(e.dictionaryOrder&&(a=x(a),s=x(s)),e.ignoreCase&&(a=a.toLowerCase(),s=s.toLowerCase()),e.monthSort){let i=L(a),n=L(s);return i-n}if(e.humanNumeric){let i=w(a),n=w(s);return i-n}if(e.versionSort)return D(a,s);if(e.numeric){let i=parseFloat(a)||0,n=parseFloat(s)||0;return i-n}return a.localeCompare(s)}function M(c){let{keys:t,fieldDelimiter:e,numeric:a,ignoreCase:s,reverse:i,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:l,ignoreLeadingBlanks:r,stable:u}=c;return(f,S)=>{let g=f,b=S;if(r&&(g=g.trimStart(),b=b.trimStart()),t.length===0){let h=I(g,b,{numeric:a,ignoreCase:s,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:l});if(h!==0)return i?-h:h;if(!u){let p=f.localeCompare(S);return i?-p:p}return 0}for(let m of t){let h=v(g,m,e),p=v(b,m,e);m.ignoreLeading&&(h=h.trimStart(),p=p.trimStart());let B={numeric:m.numeric??a,ignoreCase:m.ignoreCase??s,humanNumeric:m.humanNumeric??n,versionSort:m.versionSort??d,dictionaryOrder:m.dictionaryOrder??o,monthSort:m.monthSort??l},A=m.reverse??i,y=I(h,p,B);if(y!==0)return A?-y:y}if(!u){let m=f.localeCompare(S);return i?-m:m}return 0}}function E(c,t){if(t.keys.length===0){if(t.ignoreCase){let s=new Set;return c.filter(i=>{let n=i.toLowerCase();return s.has(n)?!1:(s.add(n),!0)})}return[...new Set(c)]}let e=t.keys[0],a=new Set;return c.filter(s=>{let i=v(s,e,t.fieldDelimiter);return(e.ignoreCase??t.ignoreCase)&&(i=i.toLowerCase()),a.has(i)?!1:(a.add(i),!0)})}function C(c){let t={startField:1},e="",a=c,s=a.match(/([bdfhMnrV]+)$/);s&&(e=s[1],a=a.slice(0,-e.length)),e.includes("n")&&(t.numeric=!0),e.includes("r")&&(t.reverse=!0),e.includes("f")&&(t.ignoreCase=!0),e.includes("b")&&(t.ignoreLeading=!0),e.includes("h")&&(t.humanNumeric=!0),e.includes("V")&&(t.versionSort=!0),e.includes("d")&&(t.dictionaryOrder=!0),e.includes("M")&&(t.monthSort=!0);let i=a.split(",");if(i.length===0||i[0]==="")return null;let n=i[0].split("."),d=parseInt(n[0],10);if(Number.isNaN(d)||d<1)return null;if(t.startField=d,n.length>1&&n[1]){let o=parseInt(n[1],10);!Number.isNaN(o)&&o>=1&&(t.startChar=o)}if(i.length>1&&i[1]){let o=i[1],l=o.match(/([bdfhMnrV]+)$/);if(l){let u=l[1];u.includes("n")&&(t.numeric=!0),u.includes("r")&&(t.reverse=!0),u.includes("f")&&(t.ignoreCase=!0),u.includes("b")&&(t.ignoreLeading=!0),u.includes("h")&&(t.humanNumeric=!0),u.includes("V")&&(t.versionSort=!0),u.includes("d")&&(t.dictionaryOrder=!0),u.includes("M")&&(t.monthSort=!0),o=o.slice(0,-u.length)}let r=o.split(".");if(r[0]){let u=parseInt(r[0],10);if(!Number.isNaN(u)&&u>=1&&(t.endField=u),r.length>1&&r[1]){let f=parseInt(r[1],10);!Number.isNaN(f)&&f>=1&&(t.endChar=f)}}}return t}var q={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
|
|
2
|
-
F is a field number (1-indexed)
|
|
3
|
-
C is a character position within the field (1-indexed)
|
|
4
|
-
OPTS can be: b d f h M n r V (per-key modifiers)
|
|
5
|
-
|
|
6
|
-
Examples:
|
|
7
|
-
-k1 sort by first field
|
|
8
|
-
-k2,2 sort by second field only
|
|
9
|
-
-k1.3 sort by first field starting at 3rd character
|
|
10
|
-
-k1,2n sort by fields 1-2 numerically
|
|
11
|
-
-k2 -k1 sort by field 2, then by field 1`},j={name:"sort",async execute(c,t){if(N(c))return F(q);let e={reverse:!1,numeric:!1,unique:!1,ignoreCase:!1,humanNumeric:!1,versionSort:!1,dictionaryOrder:!1,monthSort:!1,ignoreLeadingBlanks:!1,stable:!1,checkOnly:!1,outputFile:null,keys:[],fieldDelimiter:null},a=[];for(let l=0;l<c.length;l++){let r=c[l];if(r==="-r"||r==="--reverse")e.reverse=!0;else if(r==="-n"||r==="--numeric-sort")e.numeric=!0;else if(r==="-u"||r==="--unique")e.unique=!0;else if(r==="-f"||r==="--ignore-case")e.ignoreCase=!0;else if(r==="-h"||r==="--human-numeric-sort")e.humanNumeric=!0;else if(r==="-V"||r==="--version-sort")e.versionSort=!0;else if(r==="-d"||r==="--dictionary-order")e.dictionaryOrder=!0;else if(r==="-M"||r==="--month-sort")e.monthSort=!0;else if(r==="-b"||r==="--ignore-leading-blanks")e.ignoreLeadingBlanks=!0;else if(r==="-s"||r==="--stable")e.stable=!0;else if(r==="-c"||r==="--check")e.checkOnly=!0;else if(r==="-o"||r==="--output")e.outputFile=c[++l]||null;else if(r.startsWith("-o"))e.outputFile=r.slice(2)||null;else if(r.startsWith("--output="))e.outputFile=r.slice(9)||null;else if(r==="-t"||r==="--field-separator")e.fieldDelimiter=c[++l]||null;else if(r.startsWith("-t"))e.fieldDelimiter=r.slice(2)||null;else if(r.startsWith("--field-separator="))e.fieldDelimiter=r.slice(18)||null;else if(r==="-k"||r==="--key"){let u=c[++l];if(u){let f=C(u);f&&e.keys.push(f)}}else if(r.startsWith("-k")){let u=C(r.slice(2));u&&e.keys.push(u)}else if(r.startsWith("--key=")){let u=C(r.slice(6));u&&e.keys.push(u)}else{if(r.startsWith("--"))return k("sort",r);if(r.startsWith("-")&&!r.startsWith("--")){let u=!1;for(let f of r.slice(1))if(f==="r")e.reverse=!0;else if(f==="n")e.numeric=!0;else if(f==="u")e.unique=!0;else if(f==="f")e.ignoreCase=!0;else if(f==="h")e.humanNumeric=!0;else if(f==="V")e.versionSort=!0;else if(f==="d")e.dictionaryOrder=!0;else if(f==="M")e.monthSort=!0;else if(f==="b")e.ignoreLeadingBlanks=!0;else if(f==="s")e.stable=!0;else if(f==="c")e.checkOnly=!0;else{u=!0;break}if(u)return k("sort",r)}else a.push(r)}}let s=await O(t,a,{cmdName:"sort"});if(!s.ok)return s.error;let n=s.content.split(`
|
|
12
|
-
`);n.length>0&&n[n.length-1]===""&&n.pop();let d=M(e);if(e.checkOnly){for(let l=1;l<n.length;l++)if(d(n[l-1],n[l])>0)return{stdout:"",stderr:`sort: -:${l+1}: disorder: ${n[l]}
|
|
13
|
-
`,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}n.sort(d),e.unique&&(n=E(n,e));let o=n.length>0?`${n.join(`
|
|
14
|
-
`)}
|
|
15
|
-
`:"";if(e.outputFile){let l=t.fs.resolvePath(t.cwd,e.outputFile);return await t.fs.writeFile(l,o),{stdout:"",stderr:"",exitCode:0}}return{stdout:o,stderr:"",exitCode:0}}};export{j as sortCommand};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-ZVV5VXYZ.js";import{a as u,b as g}from"./chunk-74CEPOFO.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
|
-
`,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
|
-
`}else{let t=r.mode.toString(8).padStart(4,"0"),l=m(r.mode,r.isDirectory);o+=` File: ${i}
|
|
4
|
-
`,o+=` Size: ${r.size} Blocks: ${Math.ceil(r.size/512)}
|
|
5
|
-
`,o+=`Access: (${t}/${l})
|
|
6
|
-
`,o+=`Modify: ${r.mtime.toISOString()}
|
|
7
|
-
`}}catch{p+=`stat: cannot stat '${i}': No such file or directory
|
|
8
|
-
`,f=!0}}return{stdout:o,stderr:p,exitCode:f?1:0}}};function m(e,a){let s=a?"d":"-",n=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"];return s+n.join("")}export{x as statCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b as n,d as l}from"./chunk-W2EKKAIL.js";import{a as i,b as s}from"./chunk-74CEPOFO.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 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-ZVV5VXYZ.js";import{a as p,b as l}from"./chunk-74CEPOFO.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
|
-
`,a=1}return{stdout:o,stderr:n,exitCode:a}}};export{g as teeCommand};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a as f,b as c,c as u}from"./chunk-74CEPOFO.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
|
-
|
|
3
|
-
DURATION is a number with optional suffix:
|
|
4
|
-
s - seconds (default)
|
|
5
|
-
m - minutes
|
|
6
|
-
h - hours
|
|
7
|
-
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function O(n){let r=n.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!r)return null;let i=parseFloat(r[1]);switch(r[2]||"s"){case"s":return i*1e3;case"m":return i*60*1e3;case"h":return i*60*60*1e3;case"d":return i*24*60*60*1e3;default:return null}}var N={name:"timeout",async execute(n,r){if(c(n))return f(x);let i=!1,s=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="--preserve-status")i=!0,s=t+1;else if(e==="--foreground")s=t+1;else if(e==="-k"||e==="--kill-after")t++,s=t+1;else if(e.startsWith("--kill-after="))s=t+1;else if(e==="-s"||e==="--signal")t++,s=t+1;else if(e.startsWith("--signal="))s=t+1;else{if(e.startsWith("--")&&e!=="--")return u("timeout",e);if(e.startsWith("-")&&e.length>1&&e!=="--")if(e.startsWith("-k"))s=t+1;else if(e.startsWith("-s"))s=t+1;else return u("timeout",e);else{s=t;break}}}let o=n.slice(s);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
8
|
-
`,exitCode:1};let a=o[0],l=O(a);if(l===null)return{stdout:"",stderr:`timeout: invalid time interval '${a}'
|
|
9
|
-
`,exitCode:1};let m=o.slice(1);if(m.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
10
|
-
`,exitCode:1};if(!r.exec)return{stdout:"",stderr:`timeout: exec not available
|
|
11
|
-
`,exitCode:1};let h=m.map(t=>t.includes(" ")||t.includes(" ")?`'${t.replace(/'/g,"'\\''")}'`:t).join(" "),p=new Promise(t=>{setTimeout(()=>t({timedOut:!0}),l)}),g=r.exec(h).then(t=>({timedOut:!1,result:t})),d=await Promise.race([p,g]);return d.timedOut?{stdout:"",stderr:"",exitCode:124}:d.result}};export{N as timeoutCommand};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a as c,b as f,c as u}from"./chunk-74CEPOFO.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
|
-
|
|
3
|
-
DURATION is a number with optional suffix:
|
|
4
|
-
s - seconds (default)
|
|
5
|
-
m - minutes
|
|
6
|
-
h - hours
|
|
7
|
-
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function O(r){let i=r.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!i)return null;let n=parseFloat(i[1]);switch(i[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var w={name:"timeout",async execute(r,i){if(f(r))return c(x);let n=!1,s=0;for(let t=0;t<r.length;t++){let e=r[t];if(e==="--preserve-status")n=!0,s=t+1;else if(e==="--foreground")s=t+1;else if(e==="-k"||e==="--kill-after")t++,s=t+1;else if(e.startsWith("--kill-after="))s=t+1;else if(e==="-s"||e==="--signal")t++,s=t+1;else if(e.startsWith("--signal="))s=t+1;else{if(e.startsWith("--")&&e!=="--")return u("timeout",e);if(e.startsWith("-")&&e.length>1&&e!=="--")if(e.startsWith("-k"))s=t+1;else if(e.startsWith("-s"))s=t+1;else return u("timeout",e);else{s=t;break}}}let o=r.slice(s);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
8
|
-
`,exitCode:1};let a=o[0],l=O(a);if(l===null)return{stdout:"",stderr:`timeout: invalid time interval '${a}'
|
|
9
|
-
`,exitCode:1};let m=o.slice(1);if(m.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
10
|
-
`,exitCode:1};if(!i.exec)return{stdout:"",stderr:`timeout: exec not available
|
|
11
|
-
`,exitCode:1};let h=m.map(t=>t.includes(" ")||t.includes(" ")?`'${t.replace(/'/g,"'\\''")}'`:t).join(" "),p=new Promise(t=>{setTimeout(()=>t({timedOut:!0}),l)}),g=i.exec(h,{cwd:i.cwd}).then(t=>({timedOut:!1,result:t})),d=await Promise.race([p,g]);return d.timedOut?{stdout:"",stderr:"",exitCode:124}:d.result}};export{w as timeoutCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as f}from"./chunk-44UOCSGV.js";import{c as r}from"./chunk-74CEPOFO.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
|
-
`,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
|
-
`,i=1}return{stdout:"",stderr:n,exitCode:i}}};export{l as touchCommand};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{a as C}from"./chunk-ZVV5VXYZ.js";import{a as g,b as m}from"./chunk-74CEPOFO.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
|
-
a-z character range
|
|
3
|
-
[:alnum:] all letters and digits
|
|
4
|
-
[:alpha:] all letters
|
|
5
|
-
[:digit:] all digits
|
|
6
|
-
[:lower:] all lowercase letters
|
|
7
|
-
[:upper:] all uppercase letters
|
|
8
|
-
[:space:] all whitespace
|
|
9
|
-
[:blank:] horizontal whitespace
|
|
10
|
-
[:punct:] all punctuation
|
|
11
|
-
[:print:] all printable characters
|
|
12
|
-
[:graph:] all printable characters except space
|
|
13
|
-
[:cntrl:] all control characters
|
|
14
|
-
[:xdigit:] all hexadecimal digits
|
|
15
|
-
\\n, \\t, \\r escape sequences`},b={"[:alnum:]":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","[:alpha:]":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz","[:blank:]":" ","[:cntrl:]":Array.from({length:32},(r,n)=>String.fromCharCode(n)).join("").concat("\x7F"),"[:digit:]":"0123456789","[:graph:]":Array.from({length:94},(r,n)=>String.fromCharCode(33+n)).join(""),"[:lower:]":"abcdefghijklmnopqrstuvwxyz","[:print:]":Array.from({length:95},(r,n)=>String.fromCharCode(32+n)).join(""),"[:punct:]":"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~","[:space:]":`
|
|
16
|
-
\r\f\v`,"[:upper:]":"ABCDEFGHIJKLMNOPQRSTUVWXYZ","[:xdigit:]":"0123456789ABCDEFabcdef"};function S(r){let n="",e=0;for(;e<r.length;){if(r[e]==="["&&r[e+1]===":"){let l=!1;for(let[i,a]of Object.entries(b))if(r.slice(e).startsWith(i)){n+=a,e+=i.length,l=!0;break}if(l)continue}if(r[e]==="\\"&&e+1<r.length){let l=r[e+1];l==="n"?n+=`
|
|
17
|
-
`:l==="t"?n+=" ":l==="r"?n+="\r":n+=l,e+=2;continue}if(e+2<r.length&&r[e+1]==="-"){let l=r.charCodeAt(e),i=r.charCodeAt(e+2);for(let a=l;a<=i;a++)n+=String.fromCharCode(a);e+=3;continue}n+=r[e],e++}return n}var y={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},q={name:"tr",async execute(r,n){if(m(r))return g(x);let e=C("tr",r,y);if(!e.ok)return e.error;let l=e.result.flags.complement||e.result.flags.complementUpper,i=e.result.flags.delete,a=e.result.flags.squeeze,p=e.result.positional;if(p.length<1)return{stdout:"",stderr:`tr: missing operand
|
|
18
|
-
`,exitCode:1};if(!i&&!a&&p.length<2)return{stdout:"",stderr:`tr: missing operand after SET1
|
|
19
|
-
`,exitCode:1};let f=S(p[0]),s=p.length>1?S(p[1]):"",d=n.stdin,u=o=>{let t=f.includes(o);return l?!t:t},c="";if(i)for(let o of d)u(o)||(c+=o);else if(a&&p.length===1){let o="";for(let t of d)u(t)&&t===o||(c+=t,o=t)}else{if(l){let o=s.length>0?s[s.length-1]:"";for(let t of d)f.includes(t)?c+=t:c+=o}else{let o=new Map;for(let t=0;t<f.length;t++){let h=t<s.length?s[t]:s[s.length-1];o.set(f[t],h)}for(let t of d)c+=o.get(t)??t}if(a){let o="",t="";for(let h of c)s.includes(h)&&h===t||(o+=h,t=h);c=o}}return{stdout:c,stderr:"",exitCode:0}}};export{q as trCommand};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{a as P}from"./chunk-ZVV5VXYZ.js";import{a as $,b as w}from"./chunk-74CEPOFO.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
|
-
${l} director${l===1?"y":"ies"}`,u.directoriesOnly||(t+=`, ${r} file${r===1?"":"s"}`),t+=`
|
|
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
|
-
`,t.fileCount=1,t}catch{return t.stderr=`tree: ${o}: No such file or directory
|
|
5
|
-
`,t}if(t.output=`${o}
|
|
6
|
-
`,e.maxDepth!==null&&a>=e.maxDepth)return t;try{let r=(await s.fs.readdir(c)).filter(i=>!(!e.showHidden&&i.startsWith(".")));r.sort();for(let i=0;i<r.length;i++){let n=r[i],f=c==="/"?`/${n}`:`${c}/${n}`,h=i===r.length-1,y=h?"`-- ":"|-- ",p=u+(h?" ":"| ");try{if((await s.fs.stat(f)).isDirectory){t.dirCount++;let d=e.fullPath?f:n;if(t.output+=`${u+y+d}
|
|
7
|
-
`,e.maxDepth===null||a+1<e.maxDepth){let C=await D(s,f,e,p,a+1);t.output+=C.output,t.dirCount+=C.dirCount,t.fileCount+=C.fileCount}}else if(!e.directoriesOnly){t.fileCount++;let d=e.fullPath?f:n;t.output+=`${u+y+d}
|
|
8
|
-
`}}catch{}}}catch{t.stderr=`tree: ${o}: Permission denied
|
|
9
|
-
`}return t}async function D(s,o,e,u,a){let t={output:"",stderr:"",dirCount:0,fileCount:0};if(e.maxDepth!==null&&a>=e.maxDepth)return t;try{let l=(await s.fs.readdir(o)).filter(r=>!(!e.showHidden&&r.startsWith(".")));l.sort();for(let r=0;r<l.length;r++){let i=l[r],n=o==="/"?`/${i}`:`${o}/${i}`,f=r===l.length-1,h=f?"`-- ":"|-- ",y=u+(f?" ":"| ");try{if((await s.fs.stat(n)).isDirectory){t.dirCount++;let m=e.fullPath?n:i;t.output+=`${u+h+m}
|
|
10
|
-
`;let d=await D(s,n,e,y,a+1);t.output+=d.output,t.dirCount+=d.dirCount,t.fileCount+=d.fileCount}else if(!e.directoriesOnly){t.fileCount++;let m=e.fullPath?n:i;t.output+=`${u+h+m}
|
|
11
|
-
`}}catch{}}}catch{}return t}export{N as treeCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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};
|
|
@@ -1,4 +0,0 @@
|
|
|
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";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
|
-
`);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
|
-
`:c+=`${e}
|
|
4
|
-
`;return{stdout:c,stderr:"",exitCode:0}}};export{P as uniqCommand};
|
|
@@ -1,5 +0,0 @@
|
|
|
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";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
|
-
`,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
|
-
`}return o.length>1&&(c+=`${h({lines:u,words:d,chars:p},s,t,e,"total")}
|
|
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===`
|
|
5
|
-
`?(r++,t&&(s++,t=!1)):o===" "||o===" "||o==="\r"?t&&(s++,t=!1):t=!0}return t&&s++,{lines:r,words:s,chars:l}}function h(n,l,r,s,t){let e=[];l&&e.push(String(n.lines)),r&&e.push(String(n.words)),s&&e.push(String(n.chars));let o=e.join(" ");return t&&(o+=` ${t}`),o}export{L as wcCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-ZVV5VXYZ.js";import{a as f,b as h}from"./chunk-74CEPOFO.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
|
-
`),!c))break}a||(r=!1)}return{stdout:n,stderr:"",exitCode:r?0:1}}};export{A as whichCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as b,b as A,c as y}from"./chunk-74CEPOFO.js";var N={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(N);let h=null,c=null,l=null,x=!1,g=!1,C=!1,r=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="-I"&&t+1<n.length)h=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")x=!0,r=t+1;else if(e==="-t"||e==="--verbose")g=!0,r=t+1;else if(e==="-r"||e==="--no-run-if-empty")C=!0,r=t+1;else{if(e.startsWith("--"))return y("xargs",e);if(e.startsWith("-")&&e.length>1){for(let f of e.slice(1))if(!"0trnIP".includes(f))return y("xargs",`-${f}`);e.includes("0")&&(x=!0),e.includes("t")&&(g=!0),e.includes("r")&&(C=!0),r=t+1}else if(!e.startsWith("-")){r=t;break}}}let o=n.slice(r);o.length===0&&o.push("echo");let P=x?"\0":/\s+/,i=u.stdin.split(P).map(t=>t.trim()).filter(t=>t.length>0);if(i.length===0)return C?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",a="",m=0,w=async t=>{let e=t.join(" ");return g&&(a+=`${e}
|
|
2
|
-
`),u.exec?u.exec(e,{cwd:u.cwd}):{stdout:`${e}
|
|
3
|
-
`,stderr:"",exitCode:0}},I=async t=>{if(l!==null&&l>1)for(let e=0;e<t.length;e+=l){let s=t.slice(e,e+l),f=await Promise.all(s.map(w));for(let p of f)d+=p.stdout,a+=p.stderr,p.exitCode!==0&&(m=p.exitCode)}else for(let e of t){let s=await w(e);d+=s.stdout,a+=s.stderr,s.exitCode!==0&&(m=s.exitCode)}};if(h!==null){let t=i.map(e=>o.map(s=>s.replaceAll(h,e)));await I(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 I(t)}else{let t=[...o,...i],e=await w(t);d+=e.stdout,a+=e.stderr,m=e.exitCode}return{stdout:d,stderr:a,exitCode:m}}};export{E as xargsCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as b,b as A,c as y}from"./chunk-74CEPOFO.js";import"./chunk-2RUN43TJ.js";var N={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(N);let h=null,c=null,l=null,x=!1,g=!1,C=!1,r=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="-I"&&t+1<n.length)h=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")x=!0,r=t+1;else if(e==="-t"||e==="--verbose")g=!0,r=t+1;else if(e==="-r"||e==="--no-run-if-empty")C=!0,r=t+1;else{if(e.startsWith("--"))return y("xargs",e);if(e.startsWith("-")&&e.length>1){for(let f of e.slice(1))if(!"0trnIP".includes(f))return y("xargs",`-${f}`);e.includes("0")&&(x=!0),e.includes("t")&&(g=!0),e.includes("r")&&(C=!0),r=t+1}else if(!e.startsWith("-")){r=t;break}}}let o=n.slice(r);o.length===0&&o.push("echo");let P=x?"\0":/\s+/,i=u.stdin.split(P).map(t=>t.trim()).filter(t=>t.length>0);if(i.length===0)return C?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",a="",m=0,w=async t=>{let e=t.join(" ");return g&&(a+=`${e}
|
|
2
|
-
`),u.exec?u.exec(e,{cwd:u.cwd}):{stdout:`${e}
|
|
3
|
-
`,stderr:"",exitCode:0}},I=async t=>{if(l!==null&&l>1)for(let e=0;e<t.length;e+=l){let s=t.slice(e,e+l),f=await Promise.all(s.map(w));for(let p of f)d+=p.stdout,a+=p.stderr,p.exitCode!==0&&(m=p.exitCode)}else for(let e of t){let s=await w(e);d+=s.stdout,a+=s.stderr,s.exitCode!==0&&(m=s.exitCode)}};if(h!==null){let t=i.map(e=>o.map(s=>s.replaceAll(h,e)));await I(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 I(t)}else{let t=[...o,...i],e=await w(t);d+=e.stdout,a+=e.stderr,m=e.exitCode}return{stdout:d,stderr:a,exitCode:m}}};export{E as xargsCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as w,b as A,c as I}from"./chunk-74CEPOFO.js";var N={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,p){if(A(n))return w(N);let h=null,u=null,l=null,x=!1,g=!1,C=!1,r=0;for(let t=0;t<n.length;t++){let e=n[t];if(e==="-I"&&t+1<n.length)h=n[++t],r=t+1;else if(e==="-n"&&t+1<n.length)u=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")x=!0,r=t+1;else if(e==="-t"||e==="--verbose")g=!0,r=t+1;else if(e==="-r"||e==="--no-run-if-empty")C=!0,r=t+1;else{if(e.startsWith("--"))return I("xargs",e);if(e.startsWith("-")&&e.length>1){for(let m of e.slice(1))if(!"0trnIP".includes(m))return I("xargs",`-${m}`);e.includes("0")&&(x=!0),e.includes("t")&&(g=!0),e.includes("r")&&(C=!0),r=t+1}else if(!e.startsWith("-")){r=t;break}}}let o=n.slice(r);o.length===0&&o.push("echo");let P=x?"\0":/\s+/,i=p.stdin.split(P).map(t=>t.trim()).filter(t=>t.length>0);if(i.length===0)return C?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let c="",a="",d=0,y=async t=>{let e=t.join(" ");return g&&(a+=`${e}
|
|
2
|
-
`),p.exec?p.exec(e):{stdout:`${e}
|
|
3
|
-
`,stderr:"",exitCode:0}},b=async t=>{if(l!==null&&l>1)for(let e=0;e<t.length;e+=l){let s=t.slice(e,e+l),m=await Promise.all(s.map(y));for(let f of m)c+=f.stdout,a+=f.stderr,f.exitCode!==0&&(d=f.exitCode)}else for(let e of t){let s=await y(e);c+=s.stdout,a+=s.stderr,s.exitCode!==0&&(d=s.exitCode)}};if(h!==null){let t=i.map(e=>o.map(s=>s.replaceAll(h,e)));await b(t)}else if(u!==null){let t=[];for(let e=0;e<i.length;e+=u){let s=i.slice(e,e+u);t.push([...o,...s])}await b(t)}else{let t=[...o,...i],e=await y(t);c+=e.stdout,a+=e.stderr,d=e.exitCode}return{stdout:c,stderr:a,exitCode:d}}};export{E as xargsCommand};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AwkContext } from "./types.js";
|
|
2
|
-
export declare function awkMatch(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): number;
|
|
3
|
-
export declare function awkGensub(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): string;
|
|
4
|
-
export declare function awkLength(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): number;
|
|
5
|
-
export declare function awkSubstr(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): string;
|
|
6
|
-
export declare function awkIndex(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): number;
|
|
7
|
-
export declare function awkSplit(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): number;
|
|
8
|
-
export declare function awkSub(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): number;
|
|
9
|
-
export declare function awkGsub(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): number;
|
|
10
|
-
export declare function awkTolower(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): string;
|
|
11
|
-
export declare function awkToupper(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): string;
|
|
12
|
-
export declare function awkSprintf(args: string[], ctx: AwkContext, evaluateExpr: (expr: string, ctx: AwkContext) => string | number): string;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AWK Interpreter
|
|
3
|
-
*
|
|
4
|
-
* Tree-walking interpreter that executes an AWK AST.
|
|
5
|
-
*/
|
|
6
|
-
import type { AwkExpr, AwkFunctionDef, AwkProgram } from "./ast.js";
|
|
7
|
-
export type AwkValue = string | number;
|
|
8
|
-
export interface AwkRuntimeContext {
|
|
9
|
-
FS: string;
|
|
10
|
-
OFS: string;
|
|
11
|
-
ORS: string;
|
|
12
|
-
NR: number;
|
|
13
|
-
NF: number;
|
|
14
|
-
FNR: number;
|
|
15
|
-
FILENAME: string;
|
|
16
|
-
RSTART: number;
|
|
17
|
-
RLENGTH: number;
|
|
18
|
-
SUBSEP: string;
|
|
19
|
-
fields: string[];
|
|
20
|
-
line: string;
|
|
21
|
-
vars: Record<string, AwkValue>;
|
|
22
|
-
arrays: Record<string, Record<string, AwkValue>>;
|
|
23
|
-
functions: Map<string, AwkFunctionDef>;
|
|
24
|
-
lines?: string[];
|
|
25
|
-
lineIndex?: number;
|
|
26
|
-
fieldSep: RegExp;
|
|
27
|
-
maxIterations: number;
|
|
28
|
-
maxRecursionDepth: number;
|
|
29
|
-
currentRecursionDepth: number;
|
|
30
|
-
exitCode: number;
|
|
31
|
-
shouldExit: boolean;
|
|
32
|
-
shouldNext: boolean;
|
|
33
|
-
loopBreak: boolean;
|
|
34
|
-
loopContinue: boolean;
|
|
35
|
-
returnValue?: AwkValue;
|
|
36
|
-
hasReturn: boolean;
|
|
37
|
-
output: string;
|
|
38
|
-
random?: () => number;
|
|
39
|
-
}
|
|
40
|
-
export declare function createRuntimeContext(fieldSep?: RegExp, maxIterations?: number): AwkRuntimeContext;
|
|
41
|
-
export declare class AwkInterpreter {
|
|
42
|
-
private ctx;
|
|
43
|
-
private program;
|
|
44
|
-
private rangeStates;
|
|
45
|
-
constructor(ctx: AwkRuntimeContext);
|
|
46
|
-
execute(program: AwkProgram): string;
|
|
47
|
-
executeBegin(): void;
|
|
48
|
-
executeLine(line: string): void;
|
|
49
|
-
executeEnd(): void;
|
|
50
|
-
getOutput(): string;
|
|
51
|
-
getExitCode(): number;
|
|
52
|
-
private splitFields;
|
|
53
|
-
private matchesRule;
|
|
54
|
-
private matchPattern;
|
|
55
|
-
private matchRegex;
|
|
56
|
-
private executeBlock;
|
|
57
|
-
private executeStmt;
|
|
58
|
-
private executePrint;
|
|
59
|
-
private executePrintf;
|
|
60
|
-
private executeIf;
|
|
61
|
-
private executeWhile;
|
|
62
|
-
private executeDoWhile;
|
|
63
|
-
private executeFor;
|
|
64
|
-
private executeForIn;
|
|
65
|
-
private executeDelete;
|
|
66
|
-
evalExpr(expr: AwkExpr): AwkValue;
|
|
67
|
-
private getField;
|
|
68
|
-
private setField;
|
|
69
|
-
private getVariable;
|
|
70
|
-
private setVariable;
|
|
71
|
-
private getArrayElement;
|
|
72
|
-
private setArrayElement;
|
|
73
|
-
private evalBinaryOp;
|
|
74
|
-
private isComparisonOp;
|
|
75
|
-
private evalComparison;
|
|
76
|
-
private looksLikeNumber;
|
|
77
|
-
private evalUnaryOp;
|
|
78
|
-
private evalFunctionCall;
|
|
79
|
-
private callUserFunction;
|
|
80
|
-
private evalAssignment;
|
|
81
|
-
private evalPreIncrement;
|
|
82
|
-
private evalPreDecrement;
|
|
83
|
-
private evalPostIncrement;
|
|
84
|
-
private evalPostDecrement;
|
|
85
|
-
private evalInExpr;
|
|
86
|
-
private evalGetline;
|
|
87
|
-
isTruthy(val: AwkValue): boolean;
|
|
88
|
-
toNumber(val: AwkValue): number;
|
|
89
|
-
toString(val: AwkValue): string;
|
|
90
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export interface AwkContext {
|
|
2
|
-
FS: string;
|
|
3
|
-
OFS: string;
|
|
4
|
-
NR: number;
|
|
5
|
-
NF: number;
|
|
6
|
-
FNR: number;
|
|
7
|
-
FILENAME: string;
|
|
8
|
-
RSTART: number;
|
|
9
|
-
RLENGTH: number;
|
|
10
|
-
fields: string[];
|
|
11
|
-
line: string;
|
|
12
|
-
vars: Record<string, string | number>;
|
|
13
|
-
arrays: Record<string, Record<string, string | number>>;
|
|
14
|
-
functions: Record<string, AwkFunction>;
|
|
15
|
-
random?: () => number;
|
|
16
|
-
lines?: string[];
|
|
17
|
-
lineIndex?: number;
|
|
18
|
-
fieldSep?: RegExp;
|
|
19
|
-
maxIterations?: number;
|
|
20
|
-
exitCode?: number;
|
|
21
|
-
shouldExit?: boolean;
|
|
22
|
-
shouldNext?: boolean;
|
|
23
|
-
loopBreak?: boolean;
|
|
24
|
-
loopContinue?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface AwkFunction {
|
|
27
|
-
params: string[];
|
|
28
|
-
body: string;
|
|
29
|
-
}
|
|
30
|
-
export interface PatternRange {
|
|
31
|
-
start: string;
|
|
32
|
-
end: string;
|
|
33
|
-
}
|
|
34
|
-
export interface AwkRule {
|
|
35
|
-
pattern: string | null;
|
|
36
|
-
range?: PatternRange;
|
|
37
|
-
action: string;
|
|
38
|
-
}
|
|
39
|
-
export interface ParsedProgram {
|
|
40
|
-
begin: string | null;
|
|
41
|
-
main: AwkRule[];
|
|
42
|
-
end: string | null;
|
|
43
|
-
functions: Record<string, AwkFunction>;
|
|
44
|
-
}
|
package/dist/fs-interface.d.ts
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported buffer encodings
|
|
3
|
-
*/
|
|
4
|
-
export type BufferEncoding = "utf8" | "utf-8" | "ascii" | "binary" | "base64" | "hex" | "latin1";
|
|
5
|
-
/**
|
|
6
|
-
* File content can be string or Buffer
|
|
7
|
-
*/
|
|
8
|
-
export type FileContent = string | Uint8Array;
|
|
9
|
-
/**
|
|
10
|
-
* Options for reading files
|
|
11
|
-
*/
|
|
12
|
-
export interface ReadFileOptions {
|
|
13
|
-
encoding?: BufferEncoding | null;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Options for writing files
|
|
17
|
-
*/
|
|
18
|
-
export interface WriteFileOptions {
|
|
19
|
-
encoding?: BufferEncoding;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* File system entry types
|
|
23
|
-
*/
|
|
24
|
-
export interface FileEntry {
|
|
25
|
-
type: "file";
|
|
26
|
-
content: string | Uint8Array;
|
|
27
|
-
mode: number;
|
|
28
|
-
mtime: Date;
|
|
29
|
-
}
|
|
30
|
-
export interface DirectoryEntry {
|
|
31
|
-
type: "directory";
|
|
32
|
-
mode: number;
|
|
33
|
-
mtime: Date;
|
|
34
|
-
}
|
|
35
|
-
export interface SymlinkEntry {
|
|
36
|
-
type: "symlink";
|
|
37
|
-
target: string;
|
|
38
|
-
mode: number;
|
|
39
|
-
mtime: Date;
|
|
40
|
-
}
|
|
41
|
-
export type FsEntry = FileEntry | DirectoryEntry | SymlinkEntry;
|
|
42
|
-
/**
|
|
43
|
-
* Stat result from the filesystem
|
|
44
|
-
*/
|
|
45
|
-
export interface FsStat {
|
|
46
|
-
isFile: boolean;
|
|
47
|
-
isDirectory: boolean;
|
|
48
|
-
isSymbolicLink: boolean;
|
|
49
|
-
mode: number;
|
|
50
|
-
size: number;
|
|
51
|
-
mtime: Date;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Options for mkdir operation
|
|
55
|
-
*/
|
|
56
|
-
export interface MkdirOptions {
|
|
57
|
-
recursive?: boolean;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Options for rm operation
|
|
61
|
-
*/
|
|
62
|
-
export interface RmOptions {
|
|
63
|
-
recursive?: boolean;
|
|
64
|
-
force?: boolean;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Options for cp operation
|
|
68
|
-
*/
|
|
69
|
-
export interface CpOptions {
|
|
70
|
-
recursive?: boolean;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Abstract filesystem interface that can be implemented by different backends.
|
|
74
|
-
* This allows BashEnv to work with:
|
|
75
|
-
* - VirtualFs (in-memory, default)
|
|
76
|
-
* - Real filesystem (via node:fs)
|
|
77
|
-
* - Custom implementations (e.g., remote storage, browser IndexedDB)
|
|
78
|
-
*/
|
|
79
|
-
export interface IFileSystem {
|
|
80
|
-
/**
|
|
81
|
-
* Read the contents of a file as a string (default: utf8)
|
|
82
|
-
* @throws Error if file doesn't exist or is a directory
|
|
83
|
-
*/
|
|
84
|
-
readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string>;
|
|
85
|
-
/**
|
|
86
|
-
* Read the contents of a file as a Uint8Array (binary)
|
|
87
|
-
* @throws Error if file doesn't exist or is a directory
|
|
88
|
-
*/
|
|
89
|
-
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
90
|
-
/**
|
|
91
|
-
* Write content to a file, creating it if it doesn't exist
|
|
92
|
-
*/
|
|
93
|
-
writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Append content to a file, creating it if it doesn't exist
|
|
96
|
-
*/
|
|
97
|
-
appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Check if a path exists
|
|
100
|
-
*/
|
|
101
|
-
exists(path: string): Promise<boolean>;
|
|
102
|
-
/**
|
|
103
|
-
* Get file/directory information
|
|
104
|
-
* @throws Error if path doesn't exist
|
|
105
|
-
*/
|
|
106
|
-
stat(path: string): Promise<FsStat>;
|
|
107
|
-
/**
|
|
108
|
-
* Create a directory
|
|
109
|
-
* @throws Error if parent doesn't exist (unless recursive) or path exists
|
|
110
|
-
*/
|
|
111
|
-
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* Read directory contents
|
|
114
|
-
* @returns Array of entry names (not full paths)
|
|
115
|
-
* @throws Error if path doesn't exist or is not a directory
|
|
116
|
-
*/
|
|
117
|
-
readdir(path: string): Promise<string[]>;
|
|
118
|
-
/**
|
|
119
|
-
* Remove a file or directory
|
|
120
|
-
* @throws Error if path doesn't exist (unless force) or directory not empty (unless recursive)
|
|
121
|
-
*/
|
|
122
|
-
rm(path: string, options?: RmOptions): Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Copy a file or directory
|
|
125
|
-
* @throws Error if source doesn't exist or trying to copy directory without recursive
|
|
126
|
-
*/
|
|
127
|
-
cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* Move/rename a file or directory
|
|
130
|
-
*/
|
|
131
|
-
mv(src: string, dest: string): Promise<void>;
|
|
132
|
-
/**
|
|
133
|
-
* Resolve a relative path against a base path
|
|
134
|
-
*/
|
|
135
|
-
resolvePath(base: string, path: string): string;
|
|
136
|
-
/**
|
|
137
|
-
* Get all paths in the filesystem (useful for glob matching)
|
|
138
|
-
* Optional - implementations may return empty array if not supported
|
|
139
|
-
*/
|
|
140
|
-
getAllPaths(): string[];
|
|
141
|
-
/**
|
|
142
|
-
* Change file/directory permissions
|
|
143
|
-
* @throws Error if path doesn't exist
|
|
144
|
-
*/
|
|
145
|
-
chmod(path: string, mode: number): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
* Create a symbolic link
|
|
148
|
-
* @param target - The path the symlink should point to
|
|
149
|
-
* @param linkPath - The path where the symlink will be created
|
|
150
|
-
* @throws Error if linkPath already exists
|
|
151
|
-
*/
|
|
152
|
-
symlink(target: string, linkPath: string): Promise<void>;
|
|
153
|
-
/**
|
|
154
|
-
* Create a hard link
|
|
155
|
-
* @param existingPath - The existing file to link to
|
|
156
|
-
* @param newPath - The path where the new link will be created
|
|
157
|
-
* @throws Error if existingPath doesn't exist or newPath already exists
|
|
158
|
-
*/
|
|
159
|
-
link(existingPath: string, newPath: string): Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* Read the target of a symbolic link
|
|
162
|
-
* @throws Error if path doesn't exist or is not a symlink
|
|
163
|
-
*/
|
|
164
|
-
readlink(path: string): Promise<string>;
|
|
165
|
-
/**
|
|
166
|
-
* Get file/directory information without following symlinks
|
|
167
|
-
* @throws Error if path doesn't exist
|
|
168
|
-
*/
|
|
169
|
-
lstat(path: string): Promise<FsStat>;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Extended file initialization options with optional metadata
|
|
173
|
-
*/
|
|
174
|
-
export interface FileInit {
|
|
175
|
-
content: FileContent;
|
|
176
|
-
mode?: number;
|
|
177
|
-
mtime?: Date;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Initial files can be simple content or extended options with metadata
|
|
181
|
-
*/
|
|
182
|
-
export type InitialFiles = Record<string, FileContent | FileInit>;
|
|
183
|
-
/**
|
|
184
|
-
* Factory function type for creating filesystem instances
|
|
185
|
-
*/
|
|
186
|
-
export type FileSystemFactory = (initialFiles?: InitialFiles) => IFileSystem;
|