just-bash 1.0.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/LICENSE +201 -0
- package/README.md +326 -0
- package/dist/Bash.d.ts +90 -0
- package/dist/ai/index.d.ts +56 -0
- package/dist/ast/types.d.ts +518 -0
- package/dist/bin/chunks/alias-74DFXE2E.js +7 -0
- package/dist/bin/chunks/awk-S63F6IYK.js +15 -0
- package/dist/bin/chunks/base64-NC7HTKLZ.js +5 -0
- package/dist/bin/chunks/basename-Y7JDBYHN.js +6 -0
- package/dist/bin/chunks/bash-TQGTNXAE.js +7 -0
- package/dist/bin/chunks/cat-YZXBF5YF.js +6 -0
- package/dist/bin/chunks/chmod-3G4LK462.js +9 -0
- package/dist/bin/chunks/chunk-26Q3PZQ6.js +2 -0
- package/dist/bin/chunks/chunk-4VDEBYW7.js +2 -0
- package/dist/bin/chunks/chunk-5KNEBKYN.js +2 -0
- package/dist/bin/chunks/chunk-GTNBSMZR.js +23 -0
- package/dist/bin/chunks/chunk-J7BCMQDI.js +16 -0
- package/dist/bin/chunks/chunk-J7MJV6WO.js +3 -0
- package/dist/bin/chunks/chunk-LV662IGP.js +6 -0
- package/dist/bin/chunks/chunk-TA7RUHGQ.js +4 -0
- package/dist/bin/chunks/clear-GTCFHSB2.js +2 -0
- package/dist/bin/chunks/cp-77UY7PGN.js +8 -0
- package/dist/bin/chunks/curl-NE7XEWMN.js +26 -0
- package/dist/bin/chunks/cut-UYV3FM7R.js +6 -0
- package/dist/bin/chunks/date-7NBRXV2Z.js +5 -0
- package/dist/bin/chunks/diff-TG2NXCX2.js +19 -0
- package/dist/bin/chunks/dirname-VLHP44TU.js +5 -0
- package/dist/bin/chunks/du-4FZ7WF2P.js +8 -0
- package/dist/bin/chunks/echo-DEUIS5JO.js +4 -0
- package/dist/bin/chunks/env-FVITWNHG.js +9 -0
- package/dist/bin/chunks/expr-HA2ZNL6S.js +5 -0
- package/dist/bin/chunks/find-4B67H4RP.js +11 -0
- package/dist/bin/chunks/grep-OVWU4WCZ.js +15 -0
- package/dist/bin/chunks/head-VGXR3WWL.js +2 -0
- package/dist/bin/chunks/help-5V3MPCYQ.js +16 -0
- package/dist/bin/chunks/history-PRQ4B6N2.js +3 -0
- package/dist/bin/chunks/html-to-markdown-L4UWMK4S.js +84 -0
- package/dist/bin/chunks/jq-EYSXBSCP.js +14 -0
- package/dist/bin/chunks/ln-DB7J2W5X.js +10 -0
- package/dist/bin/chunks/ls-C4MPAF3H.js +26 -0
- package/dist/bin/chunks/mkdir-LWULWDHP.js +7 -0
- package/dist/bin/chunks/mv-TDYCNSIQ.js +7 -0
- package/dist/bin/chunks/paste-R36J3G4K.js +8 -0
- package/dist/bin/chunks/printf-BOFQVMMK.js +15 -0
- package/dist/bin/chunks/pwd-X4MWD4JP.js +3 -0
- package/dist/bin/chunks/readlink-DPNOQY67.js +7 -0
- package/dist/bin/chunks/rm-W6CCBEMG.js +8 -0
- package/dist/bin/chunks/sed-7IS44XON.js +48 -0
- package/dist/bin/chunks/seq-DGJILX2Q.js +7 -0
- package/dist/bin/chunks/sleep-E4DIYGTT.js +10 -0
- package/dist/bin/chunks/sort-UJP353TM.js +15 -0
- package/dist/bin/chunks/stat-3PHITCPO.js +9 -0
- package/dist/bin/chunks/tail-YSVKBQ77.js +2 -0
- package/dist/bin/chunks/tee-UU2VS3OM.js +3 -0
- package/dist/bin/chunks/timeout-OZVAGW2H.js +12 -0
- package/dist/bin/chunks/touch-XCIAYF5I.js +4 -0
- package/dist/bin/chunks/tr-2EEKHHO6.js +20 -0
- package/dist/bin/chunks/tree-4247W67O.js +12 -0
- package/dist/bin/chunks/true-JCX733LK.js +2 -0
- package/dist/bin/chunks/uniq-W4HF6YSB.js +5 -0
- package/dist/bin/chunks/wc-CNJ3QDRA.js +6 -0
- package/dist/bin/chunks/which-HX2NMOP3.js +3 -0
- package/dist/bin/chunks/xargs-YNLVLPOF.js +4 -0
- package/dist/bin/just-bash.js +188 -0
- package/dist/bin/shell/chunks/alias-74DFXE2E.js +7 -0
- package/dist/bin/shell/chunks/awk-S63F6IYK.js +15 -0
- package/dist/bin/shell/chunks/base64-NC7HTKLZ.js +5 -0
- package/dist/bin/shell/chunks/basename-Y7JDBYHN.js +6 -0
- package/dist/bin/shell/chunks/bash-TQGTNXAE.js +7 -0
- package/dist/bin/shell/chunks/cat-YZXBF5YF.js +6 -0
- package/dist/bin/shell/chunks/chmod-3G4LK462.js +9 -0
- package/dist/bin/shell/chunks/chunk-26Q3PZQ6.js +2 -0
- package/dist/bin/shell/chunks/chunk-4VDEBYW7.js +2 -0
- package/dist/bin/shell/chunks/chunk-5KNEBKYN.js +2 -0
- package/dist/bin/shell/chunks/chunk-GTNBSMZR.js +23 -0
- package/dist/bin/shell/chunks/chunk-J7BCMQDI.js +16 -0
- package/dist/bin/shell/chunks/chunk-J7MJV6WO.js +3 -0
- package/dist/bin/shell/chunks/chunk-LV662IGP.js +6 -0
- package/dist/bin/shell/chunks/chunk-TA7RUHGQ.js +4 -0
- package/dist/bin/shell/chunks/clear-GTCFHSB2.js +2 -0
- package/dist/bin/shell/chunks/cp-77UY7PGN.js +8 -0
- package/dist/bin/shell/chunks/curl-NE7XEWMN.js +26 -0
- package/dist/bin/shell/chunks/cut-UYV3FM7R.js +6 -0
- package/dist/bin/shell/chunks/date-7NBRXV2Z.js +5 -0
- package/dist/bin/shell/chunks/diff-TG2NXCX2.js +19 -0
- package/dist/bin/shell/chunks/dirname-VLHP44TU.js +5 -0
- package/dist/bin/shell/chunks/du-4FZ7WF2P.js +8 -0
- package/dist/bin/shell/chunks/echo-DEUIS5JO.js +4 -0
- package/dist/bin/shell/chunks/env-FVITWNHG.js +9 -0
- package/dist/bin/shell/chunks/expr-HA2ZNL6S.js +5 -0
- package/dist/bin/shell/chunks/find-4B67H4RP.js +11 -0
- package/dist/bin/shell/chunks/grep-OVWU4WCZ.js +15 -0
- package/dist/bin/shell/chunks/head-VGXR3WWL.js +2 -0
- package/dist/bin/shell/chunks/help-5V3MPCYQ.js +16 -0
- package/dist/bin/shell/chunks/history-PRQ4B6N2.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-L4UWMK4S.js +84 -0
- package/dist/bin/shell/chunks/jq-EYSXBSCP.js +14 -0
- package/dist/bin/shell/chunks/ln-DB7J2W5X.js +10 -0
- package/dist/bin/shell/chunks/ls-C4MPAF3H.js +26 -0
- package/dist/bin/shell/chunks/mkdir-LWULWDHP.js +7 -0
- package/dist/bin/shell/chunks/mv-TDYCNSIQ.js +7 -0
- package/dist/bin/shell/chunks/paste-R36J3G4K.js +8 -0
- package/dist/bin/shell/chunks/printf-BOFQVMMK.js +15 -0
- package/dist/bin/shell/chunks/pwd-X4MWD4JP.js +3 -0
- package/dist/bin/shell/chunks/readlink-DPNOQY67.js +7 -0
- package/dist/bin/shell/chunks/rm-W6CCBEMG.js +8 -0
- package/dist/bin/shell/chunks/sed-7IS44XON.js +48 -0
- package/dist/bin/shell/chunks/seq-DGJILX2Q.js +7 -0
- package/dist/bin/shell/chunks/sleep-E4DIYGTT.js +10 -0
- package/dist/bin/shell/chunks/sort-UJP353TM.js +15 -0
- package/dist/bin/shell/chunks/stat-3PHITCPO.js +9 -0
- package/dist/bin/shell/chunks/tail-YSVKBQ77.js +2 -0
- package/dist/bin/shell/chunks/tee-UU2VS3OM.js +3 -0
- package/dist/bin/shell/chunks/timeout-OZVAGW2H.js +12 -0
- package/dist/bin/shell/chunks/touch-XCIAYF5I.js +4 -0
- package/dist/bin/shell/chunks/tr-2EEKHHO6.js +20 -0
- package/dist/bin/shell/chunks/tree-4247W67O.js +12 -0
- package/dist/bin/shell/chunks/true-JCX733LK.js +2 -0
- package/dist/bin/shell/chunks/uniq-W4HF6YSB.js +5 -0
- package/dist/bin/shell/chunks/wc-CNJ3QDRA.js +6 -0
- package/dist/bin/shell/chunks/which-HX2NMOP3.js +3 -0
- package/dist/bin/shell/chunks/xargs-YNLVLPOF.js +4 -0
- package/dist/bin/shell/shell.js +172 -0
- package/dist/bundle/ai/index.js +541 -0
- package/dist/bundle/chunks/alias-7ZSTROM7.js +6 -0
- package/dist/bundle/chunks/awk-V4C3GTJI.js +14 -0
- package/dist/bundle/chunks/base64-WATI5PWI.js +4 -0
- package/dist/bundle/chunks/basename-SB5JXIY3.js +5 -0
- package/dist/bundle/chunks/bash-T4PXVRYX.js +6 -0
- package/dist/bundle/chunks/cat-5KESXK2M.js +5 -0
- package/dist/bundle/chunks/chmod-VLKWIL3N.js +8 -0
- package/dist/bundle/chunks/chunk-3YNHMZ5M.js +2 -0
- package/dist/bundle/chunks/chunk-44UOCSGV.js +1 -0
- package/dist/bundle/chunks/chunk-74CEPOFO.js +22 -0
- package/dist/bundle/chunks/chunk-JYYFSUWP.js +5 -0
- package/dist/bundle/chunks/chunk-UJMN5NLH.js +1 -0
- package/dist/bundle/chunks/chunk-W2EKKAIL.js +15 -0
- package/dist/bundle/chunks/chunk-ZVV5VXYZ.js +3 -0
- package/dist/bundle/chunks/clear-ZBD2DMXN.js +1 -0
- package/dist/bundle/chunks/cp-BLHAPLQZ.js +7 -0
- package/dist/bundle/chunks/curl-PA2MWGKN.js +25 -0
- package/dist/bundle/chunks/cut-7RHEYJ7Y.js +5 -0
- package/dist/bundle/chunks/date-YOOSNZVA.js +4 -0
- package/dist/bundle/chunks/diff-IVJFQANX.js +6 -0
- package/dist/bundle/chunks/dirname-Q5HDZLH2.js +4 -0
- package/dist/bundle/chunks/du-I5HYAKTQ.js +7 -0
- package/dist/bundle/chunks/echo-W2TA2N7Y.js +3 -0
- package/dist/bundle/chunks/env-OORA5GFS.js +8 -0
- package/dist/bundle/chunks/expr-A4LJAGVP.js +4 -0
- package/dist/bundle/chunks/find-K3NO35MZ.js +10 -0
- package/dist/bundle/chunks/grep-3D2INI4S.js +14 -0
- package/dist/bundle/chunks/head-7H5R4WKO.js +1 -0
- package/dist/bundle/chunks/help-SDCRRU2F.js +15 -0
- package/dist/bundle/chunks/history-7Z2STZ6Y.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-XMBYO6FD.js +4 -0
- package/dist/bundle/chunks/jq-7R2XGLLH.js +13 -0
- package/dist/bundle/chunks/ln-UTUVIAFP.js +9 -0
- package/dist/bundle/chunks/ls-B7C35UDO.js +23 -0
- package/dist/bundle/chunks/mkdir-WYI2LJ6H.js +6 -0
- package/dist/bundle/chunks/mv-GN23UIZU.js +6 -0
- package/dist/bundle/chunks/paste-L4TYPVSP.js +7 -0
- package/dist/bundle/chunks/printf-3ZT5XOIZ.js +14 -0
- package/dist/bundle/chunks/pwd-ZVX5RTL4.js +2 -0
- package/dist/bundle/chunks/readlink-HHC33N5C.js +6 -0
- package/dist/bundle/chunks/rm-5X2XSQQ6.js +7 -0
- package/dist/bundle/chunks/sed-UZJSXYQZ.js +47 -0
- package/dist/bundle/chunks/seq-TFPZQZPJ.js +6 -0
- package/dist/bundle/chunks/sleep-QJBQD6VS.js +9 -0
- package/dist/bundle/chunks/sort-LHMQWYH2.js +14 -0
- package/dist/bundle/chunks/stat-TM5F5YO4.js +8 -0
- package/dist/bundle/chunks/tail-BLGGG2VX.js +1 -0
- package/dist/bundle/chunks/tee-VCNOG5VI.js +2 -0
- package/dist/bundle/chunks/timeout-THAT7IOO.js +11 -0
- package/dist/bundle/chunks/touch-Z5XRYFYY.js +3 -0
- package/dist/bundle/chunks/tr-UV4V27RJ.js +19 -0
- package/dist/bundle/chunks/tree-75UXQ4XJ.js +11 -0
- package/dist/bundle/chunks/true-OD7ZXH3O.js +1 -0
- package/dist/bundle/chunks/uniq-IIOQKNTS.js +4 -0
- package/dist/bundle/chunks/wc-OXLYBRUE.js +5 -0
- package/dist/bundle/chunks/which-ONWH3TNF.js +2 -0
- package/dist/bundle/chunks/xargs-E5JPQL24.js +3 -0
- package/dist/bundle/index.js +141 -0
- package/dist/commands/alias/alias.d.ts +3 -0
- package/dist/commands/awk/awk.d.ts +2 -0
- package/dist/commands/awk/executor.d.ts +3 -0
- package/dist/commands/awk/expressions.d.ts +3 -0
- package/dist/commands/awk/functions.d.ts +12 -0
- package/dist/commands/awk/parser.d.ts +3 -0
- package/dist/commands/awk/types.d.ts +44 -0
- package/dist/commands/base64/base64.d.ts +5 -0
- package/dist/commands/basename/basename.d.ts +2 -0
- package/dist/commands/bash/bash.d.ts +3 -0
- package/dist/commands/cat/cat.d.ts +2 -0
- package/dist/commands/chmod/chmod.d.ts +2 -0
- package/dist/commands/clear/clear.d.ts +2 -0
- package/dist/commands/cp/cp.d.ts +2 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +21 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/types.d.ts +31 -0
- package/dist/commands/curl/utils.d.ts +20 -0
- package/dist/commands/cut/cut.d.ts +2 -0
- package/dist/commands/date/date.d.ts +5 -0
- package/dist/commands/diff/diff.d.ts +5 -0
- package/dist/commands/dirname/dirname.d.ts +2 -0
- package/dist/commands/du/du.d.ts +2 -0
- package/dist/commands/echo/echo.d.ts +2 -0
- package/dist/commands/env/env.d.ts +3 -0
- package/dist/commands/expr/expr.d.ts +7 -0
- package/dist/commands/find/find.d.ts +2 -0
- package/dist/commands/find/matcher.d.ts +3 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +70 -0
- package/dist/commands/grep/grep.d.ts +4 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +2 -0
- package/dist/commands/help/help.d.ts +2 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +2 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +7 -0
- package/dist/commands/jq/jq.d.ts +14 -0
- package/dist/commands/ln/ln.d.ts +2 -0
- package/dist/commands/ls/ls.d.ts +2 -0
- package/dist/commands/mkdir/mkdir.d.ts +2 -0
- package/dist/commands/mv/mv.d.ts +2 -0
- package/dist/commands/paste/paste.d.ts +2 -0
- package/dist/commands/printf/printf.d.ts +2 -0
- package/dist/commands/pwd/pwd.d.ts +2 -0
- package/dist/commands/readlink/readlink.d.ts +2 -0
- package/dist/commands/registry.d.ts +33 -0
- package/dist/commands/rm/rm.d.ts +2 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/parser.d.ts +5 -0
- package/dist/commands/sed/sed.d.ts +2 -0
- package/dist/commands/sed/types.d.ts +141 -0
- package/dist/commands/seq/seq.d.ts +14 -0
- package/dist/commands/sleep/sleep.d.ts +2 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +2 -0
- package/dist/commands/sort/types.d.ts +18 -0
- package/dist/commands/stat/stat.d.ts +2 -0
- package/dist/commands/tail/tail.d.ts +2 -0
- package/dist/commands/tee/tee.d.ts +2 -0
- package/dist/commands/timeout/timeout.d.ts +2 -0
- package/dist/commands/touch/touch.d.ts +2 -0
- package/dist/commands/tr/tr.d.ts +2 -0
- package/dist/commands/tree/tree.d.ts +2 -0
- package/dist/commands/true/true.d.ts +3 -0
- package/dist/commands/uniq/uniq.d.ts +2 -0
- package/dist/commands/wc/wc.d.ts +2 -0
- package/dist/commands/which/which.d.ts +2 -0
- package/dist/commands/xargs/xargs.d.ts +2 -0
- package/dist/fs-interface.d.ts +186 -0
- package/dist/fs.d.ts +39 -0
- package/dist/index.d.ts +12 -0
- package/dist/interpreter/arithmetic.d.ts +29 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +9 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +13 -0
- package/dist/interpreter/builtins/index.d.ts +36 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +6 -0
- package/dist/interpreter/builtins/shift.d.ts +12 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +12 -0
- package/dist/interpreter/builtins/variable-helpers.d.ts +30 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/errors.d.ts +107 -0
- package/dist/interpreter/expansion/analysis.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +20 -0
- package/dist/interpreter/expansion/pattern.d.ts +22 -0
- package/dist/interpreter/expansion/variable.d.ts +27 -0
- package/dist/interpreter/expansion/word-split.d.ts +24 -0
- package/dist/interpreter/expansion.d.ts +27 -0
- package/dist/interpreter/functions.d.ts +12 -0
- package/dist/interpreter/helpers/array.d.ts +23 -0
- package/dist/interpreter/helpers/condition.d.ts +22 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +43 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/readonly.d.ts +21 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +54 -0
- package/dist/interpreter/helpers/statements.d.ts +20 -0
- package/dist/interpreter/helpers/string-compare.d.ts +22 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-parts.d.ts +22 -0
- package/dist/interpreter/index.d.ts +3 -0
- package/dist/interpreter/interpreter.d.ts +61 -0
- package/dist/interpreter/redirections.d.ts +14 -0
- package/dist/interpreter/types.d.ts +68 -0
- package/dist/limits.d.ts +26 -0
- package/dist/network/allow-list/shared.d.ts +45 -0
- package/dist/network/allow-list.d.ts +51 -0
- package/dist/network/fetch.d.ts +25 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +85 -0
- package/dist/overlay-fs/OverlayFs.d.ts +87 -0
- package/dist/overlay-fs/index.d.ts +1 -0
- package/dist/parser/arithmetic-parser.d.ts +25 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +14 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +10 -0
- package/dist/parser/lexer.d.ts +135 -0
- package/dist/parser/parser.d.ts +92 -0
- package/dist/parser/types.d.ts +23 -0
- package/dist/parser/word-parser.d.ts +33 -0
- package/dist/sandbox/Command.d.ts +28 -0
- package/dist/sandbox/Sandbox.d.ts +60 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/types.d.ts +80 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/file-reader.d.ts +64 -0
- package/dist/utils/glob.d.ts +25 -0
- package/package.json +103 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* seq - print a sequence of numbers
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* seq LAST - print numbers from 1 to LAST
|
|
7
|
+
* seq FIRST LAST - print numbers from FIRST to LAST
|
|
8
|
+
* seq FIRST INCR LAST - print numbers from FIRST to LAST by INCR
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* -s STRING use STRING to separate numbers (default: newline)
|
|
12
|
+
* -w equalize width by padding with leading zeros
|
|
13
|
+
*/
|
|
14
|
+
export declare const seqCommand: Command;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SortOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a comparison function for sorting
|
|
4
|
+
*/
|
|
5
|
+
export declare function createComparator(options: SortOptions): (a: string, b: string) => number;
|
|
6
|
+
/**
|
|
7
|
+
* Filter unique lines based on key values or whole line
|
|
8
|
+
*/
|
|
9
|
+
export declare function filterUnique(lines: string[], options: SortOptions): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { KeySpec } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parse a key specification like:
|
|
4
|
+
* - "1" - field 1
|
|
5
|
+
* - "1,2" - fields 1 through 2
|
|
6
|
+
* - "1.3" - field 1 starting at char 3
|
|
7
|
+
* - "1.3,2.5" - field 1 char 3 through field 2 char 5
|
|
8
|
+
* - "1n" - field 1, numeric
|
|
9
|
+
* - "1,2nr" - fields 1-2, numeric and reverse
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseKeySpec(spec: string): KeySpec | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface KeySpec {
|
|
2
|
+
startField: number;
|
|
3
|
+
startChar?: number;
|
|
4
|
+
endField?: number;
|
|
5
|
+
endChar?: number;
|
|
6
|
+
numeric?: boolean;
|
|
7
|
+
reverse?: boolean;
|
|
8
|
+
ignoreCase?: boolean;
|
|
9
|
+
ignoreLeading?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SortOptions {
|
|
12
|
+
reverse: boolean;
|
|
13
|
+
numeric: boolean;
|
|
14
|
+
unique: boolean;
|
|
15
|
+
ignoreCase: boolean;
|
|
16
|
+
keys: KeySpec[];
|
|
17
|
+
fieldDelimiter: string | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
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;
|
package/dist/fs.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FsEntry, FsStat, IFileSystem, InitialFiles, MkdirOptions, ReadFileOptions, RmOptions, SymlinkEntry, WriteFileOptions } from "./fs-interface.js";
|
|
2
|
+
export type { BufferEncoding, FileContent, FileEntry, DirectoryEntry, SymlinkEntry, FsEntry, FsStat, IFileSystem, ReadFileOptions, WriteFileOptions, };
|
|
3
|
+
export interface FsData {
|
|
4
|
+
[path: string]: FsEntry;
|
|
5
|
+
}
|
|
6
|
+
export declare class VirtualFs implements IFileSystem {
|
|
7
|
+
private data;
|
|
8
|
+
constructor(initialFiles?: InitialFiles);
|
|
9
|
+
private normalizePath;
|
|
10
|
+
private dirname;
|
|
11
|
+
private ensureParentDirs;
|
|
12
|
+
writeFileSync(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding, metadata?: {
|
|
13
|
+
mode?: number;
|
|
14
|
+
mtime?: Date;
|
|
15
|
+
}): void;
|
|
16
|
+
readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string>;
|
|
17
|
+
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
18
|
+
writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
|
|
19
|
+
appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
|
|
20
|
+
exists(path: string): Promise<boolean>;
|
|
21
|
+
stat(path: string): Promise<FsStat>;
|
|
22
|
+
lstat(path: string): Promise<FsStat>;
|
|
23
|
+
private resolveSymlink;
|
|
24
|
+
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Synchronous version of mkdir
|
|
27
|
+
*/
|
|
28
|
+
mkdirSync(path: string, options?: MkdirOptions): void;
|
|
29
|
+
readdir(path: string): Promise<string[]>;
|
|
30
|
+
rm(path: string, options?: RmOptions): Promise<void>;
|
|
31
|
+
cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
32
|
+
mv(src: string, dest: string): Promise<void>;
|
|
33
|
+
getAllPaths(): string[];
|
|
34
|
+
resolvePath(base: string, path: string): string;
|
|
35
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
36
|
+
symlink(target: string, linkPath: string): Promise<void>;
|
|
37
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
38
|
+
readlink(path: string): Promise<string>;
|
|
39
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { BashOptions, ExecOptions } from "./Bash.js";
|
|
2
|
+
export { Bash } from "./Bash.js";
|
|
3
|
+
export type { AllCommandName, CommandName, NetworkCommandName, } from "./commands/registry.js";
|
|
4
|
+
export { getCommandNames, getNetworkCommandNames, } from "./commands/registry.js";
|
|
5
|
+
export { VirtualFs } from "./fs.js";
|
|
6
|
+
export type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FileInit, FileSystemFactory, FsEntry, FsStat, InitialFiles, MkdirOptions, RmOptions, SymlinkEntry, } from "./fs-interface.js";
|
|
7
|
+
export type { NetworkConfig } from "./network/index.js";
|
|
8
|
+
export { NetworkAccessDeniedError, RedirectNotAllowedError, TooManyRedirectsError, } from "./network/index.js";
|
|
9
|
+
export { OverlayFs, type OverlayFsOptions } from "./overlay-fs/index.js";
|
|
10
|
+
export type { CommandFinished as SandboxCommandFinished, OutputMessage, SandboxOptions, WriteFilesInput, } from "./sandbox/index.js";
|
|
11
|
+
export { Command as SandboxCommand, Sandbox } from "./sandbox/index.js";
|
|
12
|
+
export type { BashExecResult, Command, CommandContext, ExecResult, IFileSystem, } from "./types.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arithmetic Evaluation
|
|
3
|
+
*
|
|
4
|
+
* Evaluates bash arithmetic expressions including:
|
|
5
|
+
* - Basic operators (+, -, *, /, %)
|
|
6
|
+
* - Comparison operators (<, <=, >, >=, ==, !=)
|
|
7
|
+
* - Bitwise operators (&, |, ^, ~, <<, >>)
|
|
8
|
+
* - Logical operators (&&, ||, !)
|
|
9
|
+
* - Assignment operators (=, +=, -=, etc.)
|
|
10
|
+
* - Ternary operator (? :)
|
|
11
|
+
* - Pre/post increment/decrement (++, --)
|
|
12
|
+
* - Nested arithmetic: $((expr))
|
|
13
|
+
* - Command substitution: $(cmd) or `cmd`
|
|
14
|
+
*
|
|
15
|
+
* Known limitations:
|
|
16
|
+
* - Bitwise operations use JavaScript's 32-bit signed integers, not 64-bit.
|
|
17
|
+
* This means values like (1 << 31) will be negative (-2147483648) instead
|
|
18
|
+
* of the bash 64-bit result (2147483648).
|
|
19
|
+
* - Dynamic arithmetic expressions (e.g., ${base}#a where base=16) are not
|
|
20
|
+
* fully supported - variable expansion happens at parse time, not runtime.
|
|
21
|
+
*/
|
|
22
|
+
import type { ArithExpr } from "../ast/types.js";
|
|
23
|
+
import type { InterpreterContext } from "./types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Synchronous version of evaluateArithmetic for simple expressions.
|
|
26
|
+
* Does not support command substitution - those will return 0.
|
|
27
|
+
*/
|
|
28
|
+
export declare function evaluateArithmeticSync(ctx: InterpreterContext, expr: ArithExpr): number;
|
|
29
|
+
export declare function evaluateArithmetic(ctx: InterpreterContext, expr: ArithExpr): Promise<number>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* declare/typeset - Declare variables and give them attributes
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* declare - List all variables
|
|
6
|
+
* declare -p - List all variables (same as no args)
|
|
7
|
+
* declare NAME=value - Declare variable with value
|
|
8
|
+
* declare -a NAME - Declare indexed array
|
|
9
|
+
* declare -A NAME - Declare associative array
|
|
10
|
+
* declare -r NAME - Declare readonly variable
|
|
11
|
+
* declare -x NAME - Export variable
|
|
12
|
+
*
|
|
13
|
+
* Also aliased as 'typeset'
|
|
14
|
+
*/
|
|
15
|
+
import type { ExecResult } from "../../types.js";
|
|
16
|
+
import type { InterpreterContext } from "../types.js";
|
|
17
|
+
export declare function handleDeclare(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
18
|
+
/**
|
|
19
|
+
* Parse array elements from content like "1 2 3" or "'a b' c d"
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseArrayElements(content: string): string[];
|
|
22
|
+
/**
|
|
23
|
+
* readonly - Declare readonly variables
|
|
24
|
+
*
|
|
25
|
+
* Usage:
|
|
26
|
+
* readonly NAME=value - Declare readonly variable
|
|
27
|
+
* readonly NAME - Mark existing variable as readonly
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleReadonly(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* eval - Execute arguments as a shell command
|
|
3
|
+
*
|
|
4
|
+
* Concatenates all arguments and executes them as a shell command
|
|
5
|
+
* in the current environment (variables persist after eval).
|
|
6
|
+
*/
|
|
7
|
+
import type { ExecResult } from "../../types.js";
|
|
8
|
+
import type { InterpreterContext } from "../types.js";
|
|
9
|
+
export declare function handleEval(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* export - Set environment variables builtin
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* export - List all exported variables
|
|
6
|
+
* export -p - List all exported variables (same as no args)
|
|
7
|
+
* export NAME=value - Set and export variable
|
|
8
|
+
* export NAME - Export existing variable (or create empty)
|
|
9
|
+
* export -n NAME - Un-export variable (remove from env)
|
|
10
|
+
*/
|
|
11
|
+
import type { ExecResult } from "../../types.js";
|
|
12
|
+
import type { InterpreterContext } from "../types.js";
|
|
13
|
+
export declare function handleExport(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Command Handlers
|
|
3
|
+
*
|
|
4
|
+
* Shell built-in commands that modify interpreter state:
|
|
5
|
+
* - cd: Change directory
|
|
6
|
+
* - declare/typeset: Declare variables with attributes
|
|
7
|
+
* - export: Set environment variables
|
|
8
|
+
* - unset: Remove variables/functions
|
|
9
|
+
* - exit: Exit shell
|
|
10
|
+
* - local: Declare local variables in functions
|
|
11
|
+
* - readonly: Declare readonly variables
|
|
12
|
+
* - set: Set/unset shell options
|
|
13
|
+
* - break: Exit from loops
|
|
14
|
+
* - continue: Skip to next loop iteration
|
|
15
|
+
* - return: Return from a function
|
|
16
|
+
* - eval: Execute arguments as a shell command
|
|
17
|
+
* - let: Evaluate arithmetic expressions
|
|
18
|
+
* - shift: Shift positional parameters
|
|
19
|
+
* - read: Read a line of input
|
|
20
|
+
* - source/.: Execute commands from a file in current environment
|
|
21
|
+
*/
|
|
22
|
+
export { handleBreak } from "./break.js";
|
|
23
|
+
export { handleCd } from "./cd.js";
|
|
24
|
+
export { handleContinue } from "./continue.js";
|
|
25
|
+
export { handleDeclare, handleReadonly } from "./declare.js";
|
|
26
|
+
export { handleEval } from "./eval.js";
|
|
27
|
+
export { handleExit } from "./exit.js";
|
|
28
|
+
export { handleExport } from "./export.js";
|
|
29
|
+
export { handleLet } from "./let.js";
|
|
30
|
+
export { handleLocal } from "./local.js";
|
|
31
|
+
export { handleRead } from "./read.js";
|
|
32
|
+
export { handleReturn } from "./return.js";
|
|
33
|
+
export { handleSet } from "./set.js";
|
|
34
|
+
export { handleShift } from "./shift.js";
|
|
35
|
+
export { handleSource } from "./source.js";
|
|
36
|
+
export { handleUnset } from "./unset.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* let - Evaluate arithmetic expressions
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* let expr [expr ...]
|
|
6
|
+
* let "x=1" "y=x+2"
|
|
7
|
+
*
|
|
8
|
+
* Each argument is evaluated as an arithmetic expression.
|
|
9
|
+
* Returns 0 if the last expression evaluates to non-zero,
|
|
10
|
+
* returns 1 if it evaluates to zero.
|
|
11
|
+
*
|
|
12
|
+
* Note: In bash, `let x=( 1 )` passes separate args ["x=(", "1", ")"]
|
|
13
|
+
* when not quoted. The let builtin needs to handle this by joining
|
|
14
|
+
* arguments that are part of the same expression.
|
|
15
|
+
*/
|
|
16
|
+
import type { ExecResult } from "../../types.js";
|
|
17
|
+
import type { InterpreterContext } from "../types.js";
|
|
18
|
+
export declare function handleLet(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shift - Shift positional parameters
|
|
3
|
+
*
|
|
4
|
+
* shift [n]
|
|
5
|
+
*
|
|
6
|
+
* Shifts positional parameters to the left by n (default 1).
|
|
7
|
+
* $n+1 becomes $1, $n+2 becomes $2, etc.
|
|
8
|
+
* $# is decremented by n.
|
|
9
|
+
*/
|
|
10
|
+
import type { ExecResult } from "../../types.js";
|
|
11
|
+
import type { InterpreterContext } from "../types.js";
|
|
12
|
+
export declare function handleShift(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* source/. - Execute commands from a file in current environment builtin
|
|
3
|
+
*/
|
|
4
|
+
import type { ExecResult } from "../../types.js";
|
|
5
|
+
import type { InterpreterContext } from "../types.js";
|
|
6
|
+
export declare function handleSource(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* unset - Remove variables/functions builtin
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - unset VAR - remove variable
|
|
6
|
+
* - unset -v VAR - remove variable (explicit)
|
|
7
|
+
* - unset -f FUNC - remove function
|
|
8
|
+
* - unset 'a[i]' - remove array element (with arithmetic index support)
|
|
9
|
+
*/
|
|
10
|
+
import type { ExecResult } from "../../types.js";
|
|
11
|
+
import type { InterpreterContext } from "../types.js";
|
|
12
|
+
export declare function handleUnset(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable assignment helpers for declare, readonly, local, export builtins.
|
|
3
|
+
*/
|
|
4
|
+
import type { ExecResult } from "../../types.js";
|
|
5
|
+
import type { InterpreterContext } from "../types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Result of parsing an assignment argument.
|
|
8
|
+
*/
|
|
9
|
+
export interface ParsedAssignment {
|
|
10
|
+
name: string;
|
|
11
|
+
isArray: boolean;
|
|
12
|
+
arrayElements?: string[];
|
|
13
|
+
value?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse an assignment argument like "name=value" or "name=(a b c)".
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseAssignment(arg: string): ParsedAssignment;
|
|
19
|
+
/**
|
|
20
|
+
* Options for setting a variable.
|
|
21
|
+
*/
|
|
22
|
+
export interface SetVariableOptions {
|
|
23
|
+
makeReadonly?: boolean;
|
|
24
|
+
checkReadonly?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Set a variable from a parsed assignment.
|
|
28
|
+
* Returns an error result if the variable is readonly, otherwise null.
|
|
29
|
+
*/
|
|
30
|
+
export declare function setVariable(ctx: InterpreterContext, assignment: ParsedAssignment, options?: SetVariableOptions): ExecResult | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conditional Expression Evaluation
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* - [[ ... ]] conditional commands
|
|
6
|
+
* - [ ... ] and test commands
|
|
7
|
+
* - File tests (-f, -d, -e, etc.)
|
|
8
|
+
* - String tests (-z, -n, =, !=)
|
|
9
|
+
* - Numeric comparisons (-eq, -ne, -lt, etc.)
|
|
10
|
+
* - Pattern matching (==, =~)
|
|
11
|
+
*/
|
|
12
|
+
import type { ConditionalExpressionNode } from "../ast/types.js";
|
|
13
|
+
import type { ExecResult } from "../types.js";
|
|
14
|
+
import type { InterpreterContext } from "./types.js";
|
|
15
|
+
export declare function evaluateConditional(ctx: InterpreterContext, expr: ConditionalExpressionNode): Promise<boolean>;
|
|
16
|
+
export declare function evaluateTestArgs(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
17
|
+
export declare function matchPattern(value: string, pattern: string): boolean;
|