just-bash 2.5.5 → 2.7.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/AGENTS.md +3 -3
- package/dist/ast/types.d.ts +100 -11
- package/dist/bin/chunks/alias-EGIS5LUE.js +7 -0
- package/dist/bin/chunks/awk2-GFEJOWML.js +21 -0
- package/dist/bin/chunks/bash-PGDTHIM2.js +6 -0
- package/dist/bin/chunks/chmod-TYLTHXFR.js +9 -0
- package/dist/bin/chunks/chunk-D5WP4CKS.js +3 -0
- package/dist/bin/chunks/chunk-FSAGDARS.js +74 -0
- package/dist/bin/chunks/chunk-FSZWFMB4.js +16 -0
- package/dist/bin/chunks/chunk-IRUD2E3M.js +17 -0
- package/dist/bin/chunks/chunk-K5IXNHO5.js +8 -0
- package/dist/bin/chunks/chunk-KD3EODLB.js +6 -0
- package/dist/bin/{shell/chunks/echo-WSKTON6U.js → chunks/echo-7I42V66Q.js} +2 -2
- package/dist/bin/chunks/env-7A4MH7BJ.js +9 -0
- package/dist/bin/chunks/expansion-BOR3ELLC.js +2 -0
- package/dist/bin/{shell/chunks/find-CBEJ35BR.js → chunks/find-PHDZK64M.js} +1 -1
- package/dist/bin/{shell/chunks/grep-IIVQXFNI.js → chunks/grep-VX7MJMVN.js} +2 -2
- package/dist/bin/chunks/{head-DYK37Z24.js → head-TJHLLIMR.js} +1 -1
- package/dist/bin/{shell/chunks/jq-XXZPU5CA.js → chunks/jq-RGZHJNXC.js} +1 -1
- package/dist/bin/chunks/od-KRKGC2U3.js +5 -0
- package/dist/bin/chunks/printf-YPXD4CRE.js +15 -0
- package/dist/bin/chunks/pwd-L26WH2K4.js +3 -0
- package/dist/bin/chunks/python3-JGT65AEB.js +14 -0
- package/dist/bin/{shell/chunks/rg-Q4OTJOEF.js → chunks/rg-RSDLLECO.js} +1 -1
- package/dist/bin/chunks/rmdir-GOODLY5W.js +14 -0
- package/dist/bin/chunks/sed-JPDTWF4W.js +100 -0
- package/dist/bin/{shell/chunks/tail-BES27CZT.js → chunks/tail-YAUIERGN.js} +1 -1
- package/dist/bin/{shell/chunks/tar-C27YYUAS.js → chunks/tar-LFENC54A.js} +7 -7
- package/dist/bin/chunks/time-37F5EBPK.js +14 -0
- package/dist/bin/chunks/touch-IBPHJBM3.js +7 -0
- package/dist/bin/chunks/wc-SAOHEZYP.js +6 -0
- package/dist/bin/chunks/{which-73KOOLC6.js → which-FCDFBOMN.js} +1 -1
- package/dist/bin/chunks/whoami-JVLUNKSG.js +3 -0
- package/dist/bin/chunks/worker.js +1038 -0
- package/dist/bin/{shell/chunks/xan-6K2NGTHM.js → chunks/xan-5HNHTFMB.js} +19 -19
- package/dist/bin/chunks/{yq-MF2SNFGL.js → yq-PFV4T2PV.js} +1 -1
- package/dist/bin/just-bash.js +659 -135
- package/dist/bin/shell/chunks/alias-EGIS5LUE.js +7 -0
- package/dist/bin/shell/chunks/awk2-GFEJOWML.js +21 -0
- package/dist/bin/shell/chunks/bash-PGDTHIM2.js +6 -0
- package/dist/bin/shell/chunks/chmod-TYLTHXFR.js +9 -0
- package/dist/bin/shell/chunks/chunk-D5WP4CKS.js +3 -0
- package/dist/bin/shell/chunks/chunk-FSAGDARS.js +74 -0
- package/dist/bin/shell/chunks/chunk-FSZWFMB4.js +16 -0
- package/dist/bin/shell/chunks/chunk-IRUD2E3M.js +17 -0
- package/dist/bin/shell/chunks/chunk-K5IXNHO5.js +8 -0
- package/dist/bin/shell/chunks/chunk-KD3EODLB.js +6 -0
- package/dist/bin/{chunks/echo-WSKTON6U.js → shell/chunks/echo-7I42V66Q.js} +2 -2
- package/dist/bin/shell/chunks/env-7A4MH7BJ.js +9 -0
- package/dist/bin/shell/chunks/expansion-BOR3ELLC.js +2 -0
- package/dist/bin/{chunks/find-CBEJ35BR.js → shell/chunks/find-PHDZK64M.js} +1 -1
- package/dist/bin/{chunks/grep-IIVQXFNI.js → shell/chunks/grep-VX7MJMVN.js} +2 -2
- package/dist/bin/shell/chunks/{head-DYK37Z24.js → head-TJHLLIMR.js} +1 -1
- package/dist/bin/{chunks/jq-XXZPU5CA.js → shell/chunks/jq-RGZHJNXC.js} +1 -1
- package/dist/bin/shell/chunks/od-KRKGC2U3.js +5 -0
- package/dist/bin/shell/chunks/printf-YPXD4CRE.js +15 -0
- package/dist/bin/shell/chunks/pwd-L26WH2K4.js +3 -0
- package/dist/bin/shell/chunks/python3-JGT65AEB.js +14 -0
- package/dist/bin/{chunks/rg-Q4OTJOEF.js → shell/chunks/rg-RSDLLECO.js} +1 -1
- package/dist/bin/shell/chunks/rmdir-GOODLY5W.js +14 -0
- package/dist/bin/shell/chunks/sed-JPDTWF4W.js +100 -0
- package/dist/bin/{chunks/tail-BES27CZT.js → shell/chunks/tail-YAUIERGN.js} +1 -1
- package/dist/bin/{chunks/tar-C27YYUAS.js → shell/chunks/tar-LFENC54A.js} +7 -7
- package/dist/bin/shell/chunks/time-37F5EBPK.js +14 -0
- package/dist/bin/shell/chunks/touch-IBPHJBM3.js +7 -0
- package/dist/bin/shell/chunks/wc-SAOHEZYP.js +6 -0
- package/dist/bin/shell/chunks/{which-73KOOLC6.js → which-FCDFBOMN.js} +1 -1
- package/dist/bin/shell/chunks/whoami-JVLUNKSG.js +3 -0
- package/dist/bin/{chunks/xan-6K2NGTHM.js → shell/chunks/xan-5HNHTFMB.js} +19 -19
- package/dist/bin/shell/chunks/{yq-MF2SNFGL.js → yq-PFV4T2PV.js} +1 -1
- package/dist/bin/shell/shell.js +664 -140
- package/dist/bundle/browser.js +1251 -606
- package/dist/bundle/chunks/alias-ATFBB6D2.js +6 -0
- package/dist/bundle/chunks/awk2-6FBZTP57.js +20 -0
- package/dist/bundle/chunks/bash-OLRNM52U.js +5 -0
- package/dist/bundle/chunks/chmod-ODWUR7E6.js +8 -0
- package/dist/bundle/chunks/chunk-3AWP5CWK.js +73 -0
- package/dist/bundle/chunks/chunk-CXEWLFNE.js +16 -0
- package/dist/bundle/chunks/chunk-CZPA5RBA.js +5 -0
- package/dist/bundle/chunks/chunk-EEXR5ZDP.js +2 -0
- package/dist/bundle/chunks/chunk-HDQ56CKY.js +15 -0
- package/dist/bundle/chunks/chunk-PSW6BMXW.js +7 -0
- package/dist/bundle/chunks/{echo-VUHWYV6L.js → echo-6S7WE7XB.js} +2 -2
- package/dist/bundle/chunks/env-2UI6XINU.js +8 -0
- package/dist/bundle/chunks/expansion-RIGCFEMA.js +1 -0
- package/dist/bundle/chunks/{find-ACOAWALE.js → find-YGMSVGUV.js} +1 -1
- package/dist/bundle/chunks/{grep-ACVE42JK.js → grep-NIC6JNLH.js} +2 -2
- package/dist/bundle/chunks/{head-FZ6IQHYW.js → head-SA7P5NJ7.js} +1 -1
- package/dist/bundle/chunks/{jq-3YU5HRKE.js → jq-RLRYRPOJ.js} +1 -1
- package/dist/bundle/chunks/od-3FPDPLWJ.js +4 -0
- package/dist/bundle/chunks/printf-66XGXFCD.js +14 -0
- package/dist/bundle/chunks/pwd-S4NVAMC4.js +2 -0
- package/dist/bundle/chunks/python3-3OP7EKER.js +13 -0
- package/dist/bundle/chunks/{rg-YLZJWCEJ.js → rg-SRMB7L6G.js} +1 -1
- package/dist/bundle/chunks/rmdir-XFQE4ZYV.js +13 -0
- package/dist/bundle/chunks/sed-IV6HLDXU.js +99 -0
- package/dist/bundle/chunks/{tail-PD4RZR6J.js → tail-52LRAWXT.js} +1 -1
- package/dist/bundle/chunks/{tar-QWBXMF7K.js → tar-LWIHPMT6.js} +7 -7
- package/dist/bundle/chunks/time-UWXBG6CS.js +13 -0
- package/dist/bundle/chunks/touch-TDTEBHHI.js +6 -0
- package/dist/bundle/chunks/wc-HE5XARI4.js +5 -0
- package/dist/bundle/chunks/{which-M5MQ6QXQ.js → which-UBLRBDHN.js} +1 -1
- package/dist/bundle/chunks/whoami-YUDAIS32.js +2 -0
- package/dist/bundle/chunks/worker.js +1038 -0
- package/dist/bundle/chunks/{xan-2R2APJJ4.js → xan-A6VPI4HJ.js} +19 -19
- package/dist/bundle/chunks/{yq-KANM4MD2.js → yq-L665QPQU.js} +1 -1
- package/dist/bundle/index.js +657 -133
- package/dist/commands/awk/ast.d.ts +1 -0
- package/dist/commands/awk/interpreter/context.d.ts +14 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +2 -0
- package/dist/commands/awk/interpreter/{helpers.d.ts → type-coercion.d.ts} +4 -1
- package/dist/commands/awk/parser2-print.d.ts +35 -0
- package/dist/commands/awk/parser2.d.ts +42 -34
- package/dist/commands/printf/strftime.d.ts +9 -0
- package/dist/commands/python3/fs-bridge-handler.d.ts +50 -0
- package/dist/commands/python3/protocol.d.ts +138 -0
- package/dist/commands/python3/python3.d.ts +11 -0
- package/dist/commands/python3/sync-fs-backend.d.ts +59 -0
- package/dist/commands/python3/worker.d.ts +16 -0
- package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
- package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/index.d.ts +17 -0
- package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
- package/dist/commands/query-engine/evaluator.d.ts +10 -2
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +2 -132
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/value-operations.d.ts +39 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/rmdir/rmdir.d.ts +2 -0
- package/dist/commands/sed/lexer.d.ts +12 -0
- package/dist/commands/sed/parser.d.ts +9 -0
- package/dist/commands/sed/sed-regex.d.ts +23 -0
- package/dist/commands/sed/types.d.ts +13 -1
- package/dist/commands/tar/tar-options.d.ts +36 -0
- package/dist/commands/time/time.d.ts +25 -0
- package/dist/commands/whoami/whoami.d.ts +9 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +12 -0
- package/dist/fs/interface.d.ts +16 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +12 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +13 -1
- package/dist/fs/read-write-fs/read-write-fs.d.ts +13 -1
- package/dist/interpreter/alias-expansion.d.ts +23 -0
- package/dist/interpreter/arithmetic.d.ts +1 -6
- package/dist/interpreter/assignment-expansion.d.ts +24 -0
- package/dist/interpreter/builtin-dispatch.d.ts +39 -0
- package/dist/interpreter/builtins/compgen.d.ts +26 -0
- package/dist/interpreter/builtins/complete.d.ts +17 -0
- package/dist/interpreter/builtins/compopt.d.ts +28 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
- package/dist/interpreter/builtins/declare-print.d.ts +39 -0
- package/dist/interpreter/builtins/declare.d.ts +10 -4
- package/dist/interpreter/builtins/dirs.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +1 -1
- package/dist/interpreter/builtins/export.d.ts +1 -0
- package/dist/interpreter/builtins/getopts.d.ts +18 -0
- package/dist/interpreter/builtins/hash.d.ts +19 -0
- package/dist/interpreter/builtins/help.d.ts +12 -0
- package/dist/interpreter/builtins/index.d.ts +9 -1
- package/dist/interpreter/builtins/local.d.ts +1 -1
- package/dist/interpreter/builtins/read.d.ts +1 -1
- package/dist/interpreter/builtins/set.d.ts +3 -0
- package/dist/interpreter/builtins/shift.d.ts +3 -0
- package/dist/interpreter/builtins/shopt.d.ts +7 -0
- package/dist/interpreter/builtins/unset.d.ts +5 -1
- package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
- package/dist/interpreter/command-resolution.d.ts +43 -0
- package/dist/interpreter/conditionals.d.ts +1 -1
- package/dist/interpreter/errors.d.ts +36 -1
- package/dist/interpreter/expansion/analysis.d.ts +15 -17
- package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
- package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
- package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
- package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
- package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
- package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
- package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
- package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
- package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
- package/dist/interpreter/expansion/pattern.d.ts +2 -1
- package/dist/interpreter/expansion/positional-params.d.ts +59 -0
- package/dist/interpreter/expansion/prompt.d.ts +39 -0
- package/dist/interpreter/expansion/quoting.d.ts +13 -0
- package/dist/interpreter/expansion/tilde.d.ts +12 -0
- package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
- package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
- package/dist/interpreter/expansion/variable.d.ts +10 -1
- package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
- package/dist/interpreter/expansion/word-split.d.ts +11 -6
- package/dist/interpreter/expansion.d.ts +30 -4
- package/dist/interpreter/functions.d.ts +1 -1
- package/dist/interpreter/helpers/array.d.ts +20 -0
- package/dist/interpreter/helpers/ifs.d.ts +66 -5
- package/dist/interpreter/helpers/nameref.d.ts +65 -0
- package/dist/interpreter/helpers/quoting.d.ts +24 -0
- package/dist/interpreter/helpers/readonly.d.ts +28 -4
- package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/string-compare.d.ts +3 -1
- package/dist/interpreter/helpers/tilde.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +1 -1
- package/dist/interpreter/helpers/word-matching.d.ts +26 -0
- package/dist/interpreter/helpers/xtrace.d.ts +18 -0
- package/dist/interpreter/interpreter.d.ts +13 -14
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/redirections.d.ts +38 -1
- package/dist/interpreter/simple-command-assignments.d.ts +29 -0
- package/dist/interpreter/subshell-group.d.ts +32 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +255 -21
- package/dist/limits.d.ts +2 -0
- package/dist/parser/arithmetic-parser.d.ts +2 -4
- package/dist/parser/arithmetic-primaries.d.ts +45 -0
- package/dist/parser/compound-parser.d.ts +21 -7
- package/dist/parser/expansion-parser.d.ts +7 -1
- package/dist/parser/lexer.d.ts +57 -0
- package/dist/parser/parser-substitution.d.ts +62 -0
- package/dist/parser/parser.d.ts +39 -2
- package/dist/parser/types.d.ts +1 -0
- package/dist/types.d.ts +17 -0
- package/package.json +10 -5
- package/dist/bin/chunks/alias-PCMLRCRW.js +0 -7
- package/dist/bin/chunks/awk2-D2US2LMM.js +0 -20
- package/dist/bin/chunks/bash-UT3MT5UU.js +0 -7
- package/dist/bin/chunks/chmod-3DIKREF7.js +0 -9
- package/dist/bin/chunks/chunk-ACRTDIBO.js +0 -6
- package/dist/bin/chunks/chunk-DV5HL4K2.js +0 -17
- package/dist/bin/chunks/chunk-J7BCMQDI.js +0 -16
- package/dist/bin/chunks/chunk-NWWB2XRE.js +0 -6
- package/dist/bin/chunks/chunk-PM2DS2YW.js +0 -3
- package/dist/bin/chunks/env-YLLSNZZN.js +0 -9
- package/dist/bin/chunks/od-SLM7SRWU.js +0 -7
- package/dist/bin/chunks/printf-HWUQKYUM.js +0 -14
- package/dist/bin/chunks/pwd-53KG2MCJ.js +0 -3
- package/dist/bin/chunks/sed-5LQMJYRJ.js +0 -80
- package/dist/bin/chunks/touch-TSNAXMZ2.js +0 -4
- package/dist/bin/chunks/wc-QSBRKIF5.js +0 -6
- package/dist/bin/shell/chunks/alias-PCMLRCRW.js +0 -7
- package/dist/bin/shell/chunks/awk2-D2US2LMM.js +0 -20
- package/dist/bin/shell/chunks/bash-UT3MT5UU.js +0 -7
- package/dist/bin/shell/chunks/chmod-3DIKREF7.js +0 -9
- package/dist/bin/shell/chunks/chunk-ACRTDIBO.js +0 -6
- package/dist/bin/shell/chunks/chunk-DV5HL4K2.js +0 -17
- package/dist/bin/shell/chunks/chunk-J7BCMQDI.js +0 -16
- package/dist/bin/shell/chunks/chunk-NWWB2XRE.js +0 -6
- package/dist/bin/shell/chunks/chunk-PM2DS2YW.js +0 -3
- package/dist/bin/shell/chunks/env-YLLSNZZN.js +0 -9
- package/dist/bin/shell/chunks/od-SLM7SRWU.js +0 -7
- package/dist/bin/shell/chunks/printf-HWUQKYUM.js +0 -14
- package/dist/bin/shell/chunks/pwd-53KG2MCJ.js +0 -3
- package/dist/bin/shell/chunks/sed-5LQMJYRJ.js +0 -80
- package/dist/bin/shell/chunks/touch-TSNAXMZ2.js +0 -4
- package/dist/bin/shell/chunks/wc-QSBRKIF5.js +0 -6
- package/dist/bundle/chunks/alias-4UGRF4DM.js +0 -6
- package/dist/bundle/chunks/awk2-46RTIZKB.js +0 -19
- package/dist/bundle/chunks/bash-ZILV3VHA.js +0 -6
- package/dist/bundle/chunks/chmod-FBHLEIY6.js +0 -8
- package/dist/bundle/chunks/chunk-4JO5BKO4.js +0 -5
- package/dist/bundle/chunks/chunk-BOJ3OAZB.js +0 -16
- package/dist/bundle/chunks/chunk-CG2HXOFG.js +0 -5
- package/dist/bundle/chunks/chunk-NWEGHOXL.js +0 -2
- package/dist/bundle/chunks/chunk-W2EKKAIL.js +0 -15
- package/dist/bundle/chunks/env-EG5SQSAQ.js +0 -8
- package/dist/bundle/chunks/od-ECWXNUB4.js +0 -6
- package/dist/bundle/chunks/printf-VG2POOXB.js +0 -13
- package/dist/bundle/chunks/pwd-AC4P3JKI.js +0 -2
- package/dist/bundle/chunks/sed-ZKODWZ6F.js +0 -79
- package/dist/bundle/chunks/touch-MVQSKQKT.js +0 -3
- package/dist/bundle/chunks/wc-DFQKWSIZ.js +0 -5
- package/dist/interpreter/builtins/variable-helpers.d.ts +0 -30
- /package/dist/bin/chunks/{curl-LCMREE7R.js → curl-TH7YRBSA.js} +0 -0
- /package/dist/bin/chunks/{file-LNCFDPQZ.js → file-6PCTL3MH.js} +0 -0
- /package/dist/bin/shell/chunks/{curl-LCMREE7R.js → curl-TH7YRBSA.js} +0 -0
- /package/dist/bin/shell/chunks/{file-LNCFDPQZ.js → file-6PCTL3MH.js} +0 -0
- /package/dist/bundle/chunks/{curl-TVZH24MD.js → curl-XLP4VABU.js} +0 -0
- /package/dist/bundle/chunks/{file-XPA6O6H2.js → file-NQP3CKRV.js} +0 -0
- /package/dist/commands/curl/{utils.d.ts → response-formatting.d.ts} +0 -0
- /package/dist/commands/xan/{xan-utils.d.ts → column-selection.d.ts} +0 -0
- /package/dist/fs/{utils.d.ts → encoding.d.ts} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Command } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* time - time command execution
|
|
4
|
+
*
|
|
5
|
+
* Usage: time [-f FORMAT] [-o FILE] [-a] [-v] [-p] command [arguments...]
|
|
6
|
+
*
|
|
7
|
+
* Times the execution of a command and outputs timing statistics.
|
|
8
|
+
*
|
|
9
|
+
* Options:
|
|
10
|
+
* -f FORMAT Use FORMAT for output (GNU time format specifiers)
|
|
11
|
+
* -o FILE Write timing output to FILE
|
|
12
|
+
* -a Append to output file (with -o)
|
|
13
|
+
* -v Verbose output
|
|
14
|
+
* -p POSIX portable output format
|
|
15
|
+
*
|
|
16
|
+
* Format specifiers:
|
|
17
|
+
* %e Elapsed real time in seconds
|
|
18
|
+
* %M Maximum resident set size (KB)
|
|
19
|
+
* %S System CPU time (seconds)
|
|
20
|
+
* %U User CPU time (seconds)
|
|
21
|
+
*
|
|
22
|
+
* Note: In this JavaScript implementation, user/system CPU time and memory
|
|
23
|
+
* metrics are not available, so %M, %S, %U output 0.
|
|
24
|
+
*/
|
|
25
|
+
export declare const timeCommand: Command;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moonblade expression tokenizer
|
|
3
|
+
*/
|
|
4
|
+
export type TokenType = "int" | "float" | "string" | "regex" | "ident" | "true" | "false" | "null" | "(" | ")" | "[" | "]" | "{" | "}" | "," | ":" | ";" | "=>" | "+" | "-" | "*" | "/" | "//" | "%" | "**" | "++" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "&&" | "||" | "and" | "or" | "!" | "." | "|" | "in" | "not in" | "as" | "=" | "_" | "eof";
|
|
5
|
+
export interface Token {
|
|
6
|
+
type: TokenType;
|
|
7
|
+
value: string;
|
|
8
|
+
pos: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class Tokenizer {
|
|
11
|
+
private input;
|
|
12
|
+
private pos;
|
|
13
|
+
private tokens;
|
|
14
|
+
constructor(input: string);
|
|
15
|
+
tokenize(): Token[];
|
|
16
|
+
private skipWhitespace;
|
|
17
|
+
private nextToken;
|
|
18
|
+
private match;
|
|
19
|
+
private isIdentStart;
|
|
20
|
+
private isIdentChar;
|
|
21
|
+
private readNumber;
|
|
22
|
+
private readString;
|
|
23
|
+
private readRegex;
|
|
24
|
+
private readIdentifier;
|
|
25
|
+
}
|
|
@@ -48,4 +48,16 @@ export declare class InMemoryFs implements IFileSystem {
|
|
|
48
48
|
symlink(target: string, linkPath: string): Promise<void>;
|
|
49
49
|
link(existingPath: string, newPath: string): Promise<void>;
|
|
50
50
|
readlink(path: string): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve all symlinks in a path to get the canonical physical path.
|
|
53
|
+
* This is equivalent to POSIX realpath().
|
|
54
|
+
*/
|
|
55
|
+
realpath(path: string): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Set access and modification times of a file
|
|
58
|
+
* @param path - The file path
|
|
59
|
+
* @param _atime - Access time (ignored, kept for API compatibility)
|
|
60
|
+
* @param mtime - Modification time
|
|
61
|
+
*/
|
|
62
|
+
utimes(path: string, _atime: Date, mtime: Date): Promise<void>;
|
|
51
63
|
}
|
package/dist/fs/interface.d.ts
CHANGED
|
@@ -184,6 +184,22 @@ export interface IFileSystem {
|
|
|
184
184
|
* @throws Error if path doesn't exist
|
|
185
185
|
*/
|
|
186
186
|
lstat(path: string): Promise<FsStat>;
|
|
187
|
+
/**
|
|
188
|
+
* Resolve all symlinks in a path to get the canonical physical path.
|
|
189
|
+
* This is equivalent to POSIX realpath() - it resolves all symlinks
|
|
190
|
+
* in the path and returns the absolute physical path.
|
|
191
|
+
* Used by pwd -P and cd -P for symlink resolution.
|
|
192
|
+
* @throws Error if path doesn't exist or contains a broken symlink
|
|
193
|
+
*/
|
|
194
|
+
realpath(path: string): Promise<string>;
|
|
195
|
+
/**
|
|
196
|
+
* Set access and modification times of a file
|
|
197
|
+
* @param path - The file path
|
|
198
|
+
* @param atime - Access time (currently ignored, kept for API compatibility)
|
|
199
|
+
* @param mtime - Modification time
|
|
200
|
+
* @throws Error if path doesn't exist
|
|
201
|
+
*/
|
|
202
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
187
203
|
}
|
|
188
204
|
/**
|
|
189
205
|
* Extended file initialization options with optional metadata
|
|
@@ -101,8 +101,20 @@ export declare class MountableFs implements IFileSystem {
|
|
|
101
101
|
symlink(target: string, linkPath: string): Promise<void>;
|
|
102
102
|
link(existingPath: string, newPath: string): Promise<void>;
|
|
103
103
|
readlink(path: string): Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Resolve all symlinks in a path to get the canonical physical path.
|
|
106
|
+
* This is equivalent to POSIX realpath().
|
|
107
|
+
*/
|
|
108
|
+
realpath(path: string): Promise<string>;
|
|
104
109
|
/**
|
|
105
110
|
* Perform a cross-mount copy operation.
|
|
106
111
|
*/
|
|
107
112
|
private crossMountCopy;
|
|
113
|
+
/**
|
|
114
|
+
* Set access and modification times of a file
|
|
115
|
+
* @param path - The file path
|
|
116
|
+
* @param atime - Access time
|
|
117
|
+
* @param mtime - Modification time
|
|
118
|
+
*/
|
|
119
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
108
120
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Reads come from the real filesystem, writes go to an in-memory layer.
|
|
5
5
|
* Changes don't persist to disk and can't escape the root directory.
|
|
6
6
|
*/
|
|
7
|
+
import { type FileContent } from "../encoding.js";
|
|
7
8
|
import type { CpOptions, DirentEntry, FsStat, IFileSystem, MkdirOptions, ReadFileOptions, RmOptions, WriteFileOptions } from "../interface.js";
|
|
8
|
-
import { type FileContent } from "../utils.js";
|
|
9
9
|
export interface OverlayFsOptions {
|
|
10
10
|
/**
|
|
11
11
|
* The root directory on the real filesystem.
|
|
@@ -104,4 +104,16 @@ export declare class OverlayFs implements IFileSystem {
|
|
|
104
104
|
symlink(target: string, linkPath: string): Promise<void>;
|
|
105
105
|
link(existingPath: string, newPath: string): Promise<void>;
|
|
106
106
|
readlink(path: string): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve all symlinks in a path to get the canonical physical path.
|
|
109
|
+
* This is equivalent to POSIX realpath().
|
|
110
|
+
*/
|
|
111
|
+
realpath(path: string): Promise<string>;
|
|
112
|
+
/**
|
|
113
|
+
* Set access and modification times of a file
|
|
114
|
+
* @param path - The file path
|
|
115
|
+
* @param _atime - Access time (ignored, kept for API compatibility)
|
|
116
|
+
* @param mtime - Modification time
|
|
117
|
+
*/
|
|
118
|
+
utimes(path: string, _atime: Date, mtime: Date): Promise<void>;
|
|
107
119
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* All operations go directly to the underlying Node.js filesystem.
|
|
5
5
|
* This is a true read-write filesystem with no overlay or sandboxing.
|
|
6
6
|
*/
|
|
7
|
+
import { type FileContent } from "../encoding.js";
|
|
7
8
|
import type { CpOptions, DirentEntry, FsStat, IFileSystem, MkdirOptions, ReadFileOptions, RmOptions, WriteFileOptions } from "../interface.js";
|
|
8
|
-
import { type FileContent } from "../utils.js";
|
|
9
9
|
export interface ReadWriteFsOptions {
|
|
10
10
|
/**
|
|
11
11
|
* The root directory on the real filesystem.
|
|
@@ -44,4 +44,16 @@ export declare class ReadWriteFs implements IFileSystem {
|
|
|
44
44
|
symlink(target: string, linkPath: string): Promise<void>;
|
|
45
45
|
link(existingPath: string, newPath: string): Promise<void>;
|
|
46
46
|
readlink(path: string): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Resolve all symlinks in a path to get the canonical physical path.
|
|
49
|
+
* This is equivalent to POSIX realpath().
|
|
50
|
+
*/
|
|
51
|
+
realpath(path: string): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Set access and modification times of a file
|
|
54
|
+
* @param path - The file path
|
|
55
|
+
* @param atime - Access time
|
|
56
|
+
* @param mtime - Modification time
|
|
57
|
+
*/
|
|
58
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
47
59
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alias Expansion
|
|
3
|
+
*
|
|
4
|
+
* Handles bash alias expansion for SimpleCommandNodes.
|
|
5
|
+
*
|
|
6
|
+
* Alias expansion rules:
|
|
7
|
+
* 1. Only expands if command name is a literal unquoted word
|
|
8
|
+
* 2. Alias value is substituted for the command name
|
|
9
|
+
* 3. If alias value ends with a space, the next word is also checked for alias expansion
|
|
10
|
+
* 4. Recursive expansion is allowed but limited to prevent infinite loops
|
|
11
|
+
*/
|
|
12
|
+
import type { SimpleCommandNode } from "../ast/types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Context needed for alias expansion operations
|
|
15
|
+
*/
|
|
16
|
+
export interface AliasExpansionContext {
|
|
17
|
+
env: Record<string, string | undefined>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Expand alias in a SimpleCommandNode if applicable.
|
|
21
|
+
* Returns a new node with the alias expanded, or the original node if no expansion.
|
|
22
|
+
*/
|
|
23
|
+
export declare function expandAlias(ctx: AliasExpansionContext, node: SimpleCommandNode, aliasExpansionStack: Set<string>): SimpleCommandNode;
|
|
@@ -21,9 +21,4 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import type { ArithExpr } from "../ast/types.js";
|
|
23
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>;
|
|
24
|
+
export declare function evaluateArithmetic(ctx: InterpreterContext, expr: ArithExpr, isExpansionContext?: boolean): Promise<number>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assignment Expansion Helpers
|
|
3
|
+
*
|
|
4
|
+
* Handles expansion of assignment arguments for local/declare/typeset builtins.
|
|
5
|
+
* - Array assignments: name=(elem1 elem2 ...)
|
|
6
|
+
* - Scalar assignments: name=value, name+=value, name[index]=value
|
|
7
|
+
*/
|
|
8
|
+
import type { WordNode } from "../ast/types.js";
|
|
9
|
+
import type { InterpreterContext } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Check if a Word represents an array assignment (name=(...)) and expand it
|
|
12
|
+
* while preserving quote structure for elements.
|
|
13
|
+
* Returns the expanded string like "name=(elem1 elem2 ...)" or null if not an array assignment.
|
|
14
|
+
*/
|
|
15
|
+
export declare function expandLocalArrayAssignment(ctx: InterpreterContext, word: WordNode): Promise<string | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a Word represents a scalar assignment (name=value, name+=value, or name[index]=value)
|
|
18
|
+
* and expand it WITHOUT glob expansion on the value part.
|
|
19
|
+
* Returns the expanded string like "name=expanded_value" or null if not a scalar assignment.
|
|
20
|
+
*
|
|
21
|
+
* This is important for bash compatibility: `local var=$x` where x='a b' should
|
|
22
|
+
* set var to "a b", not try to glob-expand it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function expandScalarAssignmentArg(ctx: InterpreterContext, word: WordNode): Promise<string | null>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtin Command Dispatch
|
|
3
|
+
*
|
|
4
|
+
* Handles dispatch of built-in shell commands like export, unset, cd, etc.
|
|
5
|
+
* Separated from interpreter.ts for modularity.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExecResult } from "../types.js";
|
|
8
|
+
import type { InterpreterContext } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Type for the function that runs a command recursively
|
|
11
|
+
*/
|
|
12
|
+
export type RunCommandFn = (commandName: string, args: string[], quotedArgs: boolean[], stdin: string, skipFunctions?: boolean, useDefaultPath?: boolean, stdinSourceFd?: number) => Promise<ExecResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Type for the function that builds exported environment
|
|
15
|
+
*/
|
|
16
|
+
export type BuildExportedEnvFn = () => Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Type for the function that executes user scripts
|
|
19
|
+
*/
|
|
20
|
+
export type ExecuteUserScriptFn = (scriptPath: string, args: string[], stdin?: string) => Promise<ExecResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Dispatch context containing dependencies needed for builtin dispatch
|
|
23
|
+
*/
|
|
24
|
+
export interface BuiltinDispatchContext {
|
|
25
|
+
ctx: InterpreterContext;
|
|
26
|
+
runCommand: RunCommandFn;
|
|
27
|
+
buildExportedEnv: BuildExportedEnvFn;
|
|
28
|
+
executeUserScript: ExecuteUserScriptFn;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Dispatch a command to the appropriate builtin handler or external command.
|
|
32
|
+
* Returns null if the command should be handled by external command resolution.
|
|
33
|
+
*/
|
|
34
|
+
export declare function dispatchBuiltin(dispatchCtx: BuiltinDispatchContext, commandName: string, args: string[], _quotedArgs: boolean[], stdin: string, skipFunctions: boolean, _useDefaultPath: boolean, stdinSourceFd: number): Promise<ExecResult | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Handle external command resolution and execution.
|
|
37
|
+
* Called when dispatchBuiltin returns null.
|
|
38
|
+
*/
|
|
39
|
+
export declare function executeExternalCommand(dispatchCtx: BuiltinDispatchContext, commandName: string, args: string[], stdin: string, useDefaultPath: boolean): Promise<ExecResult>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compgen - Generate completion matches
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* compgen -v [prefix] - List variable names (optionally starting with prefix)
|
|
6
|
+
* compgen -A variable [prefix] - Same as -v
|
|
7
|
+
* compgen -A function [prefix] - List function names
|
|
8
|
+
* compgen -e [prefix] - List exported variable names
|
|
9
|
+
* compgen -A builtin [prefix] - List builtin command names
|
|
10
|
+
* compgen -A keyword [prefix] - List shell keywords (alias: -k)
|
|
11
|
+
* compgen -A alias [prefix] - List alias names
|
|
12
|
+
* compgen -A shopt [prefix] - List shopt options
|
|
13
|
+
* compgen -A helptopic [prefix] - List help topics
|
|
14
|
+
* compgen -A directory [prefix] - List directory names
|
|
15
|
+
* compgen -A file [prefix] - List file names
|
|
16
|
+
* compgen -f [prefix] - List file names (alias for -A file)
|
|
17
|
+
* compgen -A user - List user names
|
|
18
|
+
* compgen -A command [prefix] - List commands (builtins, functions, aliases, external)
|
|
19
|
+
* compgen -W wordlist [prefix] - Generate from wordlist
|
|
20
|
+
* compgen -P prefix - Prefix to add to completions
|
|
21
|
+
* compgen -S suffix - Suffix to add to completions
|
|
22
|
+
* compgen -o option - Completion option (plusdirs, dirnames, default, etc.)
|
|
23
|
+
*/
|
|
24
|
+
import type { ExecResult } from "../../types.js";
|
|
25
|
+
import type { InterpreterContext } from "../types.js";
|
|
26
|
+
export declare function handleCompgen(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* complete - Set and display programmable completion specifications
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* complete - List all completion specs
|
|
6
|
+
* complete -p - Print all completion specs in reusable format
|
|
7
|
+
* complete -p cmd - Print completion spec for specific command
|
|
8
|
+
* complete -W 'word1 word2' cmd - Set word list completion for cmd
|
|
9
|
+
* complete -F func cmd - Set function completion for cmd
|
|
10
|
+
* complete -r cmd - Remove completion spec for cmd
|
|
11
|
+
* complete -r - Remove all completion specs
|
|
12
|
+
* complete -D ... - Set default completion (for commands with no specific spec)
|
|
13
|
+
* complete -o opt cmd - Set completion options (nospace, filenames, default, etc.)
|
|
14
|
+
*/
|
|
15
|
+
import type { ExecResult } from "../../types.js";
|
|
16
|
+
import type { InterpreterContext } from "../types.js";
|
|
17
|
+
export declare function handleComplete(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compopt - Modify completion options
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* compopt [-o option] [+o option] [name ...]
|
|
6
|
+
* compopt -D [-o option] [+o option]
|
|
7
|
+
* compopt -E [-o option] [+o option]
|
|
8
|
+
*
|
|
9
|
+
* Modifies completion options for the specified commands (names) or the
|
|
10
|
+
* currently executing completion when no names are provided.
|
|
11
|
+
*
|
|
12
|
+
* Options:
|
|
13
|
+
* -o option Enable completion option
|
|
14
|
+
* +o option Disable completion option
|
|
15
|
+
* -D Apply to default completion
|
|
16
|
+
* -E Apply to empty-line completion
|
|
17
|
+
*
|
|
18
|
+
* Valid completion options:
|
|
19
|
+
* bashdefault, default, dirnames, filenames, noquote, nosort, nospace, plusdirs
|
|
20
|
+
*
|
|
21
|
+
* Returns:
|
|
22
|
+
* 0 on success
|
|
23
|
+
* 1 if not in a completion function and no command name is given
|
|
24
|
+
* 2 if an invalid option is specified
|
|
25
|
+
*/
|
|
26
|
+
import type { ExecResult } from "../../types.js";
|
|
27
|
+
import type { InterpreterContext } from "../types.js";
|
|
28
|
+
export declare function handleCompopt(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Array Parsing Functions for declare/typeset
|
|
3
|
+
*
|
|
4
|
+
* Handles parsing of array literal syntax for the declare builtin.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Parse array elements from content like "1 2 3" or "'a b' c d"
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseArrayElements(content: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Parse associative array literal content like "['foo']=bar ['spam']=42"
|
|
12
|
+
* Returns array of [key, value] pairs
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseAssocArrayLiteral(content: string): [string, string][];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declare Print Mode Functions
|
|
3
|
+
*
|
|
4
|
+
* Handles printing and listing variables for the declare/typeset builtin.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExecResult } from "../../types.js";
|
|
7
|
+
import type { InterpreterContext } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Print specific variables with their declarations.
|
|
10
|
+
* Handles: declare -p varname1 varname2 ...
|
|
11
|
+
*/
|
|
12
|
+
export declare function printSpecificVariables(ctx: InterpreterContext, names: string[]): ExecResult;
|
|
13
|
+
export interface PrintAllFilters {
|
|
14
|
+
filterExport: boolean;
|
|
15
|
+
filterReadonly: boolean;
|
|
16
|
+
filterNameref: boolean;
|
|
17
|
+
filterIndexedArray: boolean;
|
|
18
|
+
filterAssocArray: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Print all variables with their declarations and attributes.
|
|
22
|
+
* Handles: declare -p (with optional filters like -x, -r, -n, -a, -A)
|
|
23
|
+
*/
|
|
24
|
+
export declare function printAllVariables(ctx: InterpreterContext, filters: PrintAllFilters): ExecResult;
|
|
25
|
+
/**
|
|
26
|
+
* List all associative arrays.
|
|
27
|
+
* Handles: declare -A (without arguments)
|
|
28
|
+
*/
|
|
29
|
+
export declare function listAssociativeArrays(ctx: InterpreterContext): ExecResult;
|
|
30
|
+
/**
|
|
31
|
+
* List all indexed arrays.
|
|
32
|
+
* Handles: declare -a (without arguments)
|
|
33
|
+
*/
|
|
34
|
+
export declare function listIndexedArrays(ctx: InterpreterContext): ExecResult;
|
|
35
|
+
/**
|
|
36
|
+
* List all variables without print mode (no attributes shown).
|
|
37
|
+
* Handles: declare (without -p and without arguments)
|
|
38
|
+
*/
|
|
39
|
+
export declare function listAllVariables(ctx: InterpreterContext): ExecResult;
|
|
@@ -9,16 +9,22 @@
|
|
|
9
9
|
* declare -A NAME - Declare associative array
|
|
10
10
|
* declare -r NAME - Declare readonly variable
|
|
11
11
|
* declare -x NAME - Export variable
|
|
12
|
+
* declare -g NAME - Declare global variable (inside functions)
|
|
12
13
|
*
|
|
13
14
|
* Also aliased as 'typeset'
|
|
14
15
|
*/
|
|
15
16
|
import type { ExecResult } from "../../types.js";
|
|
16
17
|
import type { InterpreterContext } from "../types.js";
|
|
17
|
-
export declare function handleDeclare(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Check if a variable has the integer attribute.
|
|
20
20
|
*/
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function isInteger(ctx: InterpreterContext, name: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Apply case transformation based on variable attributes.
|
|
24
|
+
* Returns the transformed value.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyCaseTransform(ctx: InterpreterContext, name: string, value: string): string;
|
|
27
|
+
export declare function handleDeclare(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
22
28
|
/**
|
|
23
29
|
* readonly - Declare readonly variables
|
|
24
30
|
*
|
|
@@ -26,4 +32,4 @@ export declare function parseArrayElements(content: string): string[];
|
|
|
26
32
|
* readonly NAME=value - Declare readonly variable
|
|
27
33
|
* readonly NAME - Mark existing variable as readonly
|
|
28
34
|
*/
|
|
29
|
-
export declare function handleReadonly(ctx: InterpreterContext, args: string[]): ExecResult
|
|
35
|
+
export declare function handleReadonly(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory Stack Builtins: pushd, popd, dirs
|
|
3
|
+
*
|
|
4
|
+
* pushd [dir] - Push directory onto stack and cd to it
|
|
5
|
+
* popd - Pop directory from stack and cd to previous
|
|
6
|
+
* dirs [-clpv] - Display directory stack
|
|
7
|
+
*/
|
|
8
|
+
import type { ExecResult } from "../../types.js";
|
|
9
|
+
import type { InterpreterContext } from "../types.js";
|
|
10
|
+
/**
|
|
11
|
+
* pushd - Push directory onto stack and cd to it
|
|
12
|
+
*
|
|
13
|
+
* pushd [dir] - Push current dir, cd to dir
|
|
14
|
+
*/
|
|
15
|
+
export declare function handlePushd(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
16
|
+
/**
|
|
17
|
+
* popd - Pop directory from stack and cd to it
|
|
18
|
+
*/
|
|
19
|
+
export declare function handlePopd(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
20
|
+
/**
|
|
21
|
+
* dirs - Display directory stack
|
|
22
|
+
*
|
|
23
|
+
* dirs [-clpv]
|
|
24
|
+
* -c: Clear the stack
|
|
25
|
+
* -l: Long format (no tilde substitution)
|
|
26
|
+
* -p: One entry per line
|
|
27
|
+
* -v: One entry per line with index numbers
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleDirs(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ExecResult } from "../../types.js";
|
|
8
8
|
import type { InterpreterContext } from "../types.js";
|
|
9
|
-
export declare function handleEval(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
9
|
+
export declare function handleEval(ctx: InterpreterContext, args: string[], stdin?: string): Promise<ExecResult>;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* export - List all exported variables
|
|
6
6
|
* export -p - List all exported variables (same as no args)
|
|
7
7
|
* export NAME=value - Set and export variable
|
|
8
|
+
* export NAME+=value - Append value and export variable
|
|
8
9
|
* export NAME - Export existing variable (or create empty)
|
|
9
10
|
* export -n NAME - Un-export variable (remove from env)
|
|
10
11
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getopts - Parse positional parameters as options
|
|
3
|
+
*
|
|
4
|
+
* getopts optstring name [arg...]
|
|
5
|
+
*
|
|
6
|
+
* Parses options from positional parameters (or provided args).
|
|
7
|
+
* - optstring: string of valid option characters
|
|
8
|
+
* - If a character is followed by ':', it requires an argument
|
|
9
|
+
* - If optstring starts with ':', silent error reporting mode
|
|
10
|
+
* - name: variable to store the current option
|
|
11
|
+
* - OPTARG: set to the option argument (if any)
|
|
12
|
+
* - OPTIND: index of next argument to process (starts at 1)
|
|
13
|
+
*
|
|
14
|
+
* Returns 0 if option found, 1 if end of options or error.
|
|
15
|
+
*/
|
|
16
|
+
import type { ExecResult } from "../../types.js";
|
|
17
|
+
import type { InterpreterContext } from "../types.js";
|
|
18
|
+
export declare function handleGetopts(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hash - Manage the hash table of remembered command locations
|
|
3
|
+
*
|
|
4
|
+
* hash [-lr] [-p pathname] [-dt] [name ...]
|
|
5
|
+
*
|
|
6
|
+
* Hash maintains a hash table of recently executed commands for faster lookup.
|
|
7
|
+
*
|
|
8
|
+
* Options:
|
|
9
|
+
* (no args) Display the hash table
|
|
10
|
+
* name Add name to the hash table (look up in PATH)
|
|
11
|
+
* -r Clear the hash table
|
|
12
|
+
* -d name Remove name from the hash table
|
|
13
|
+
* -l Display in a format that can be reused as input
|
|
14
|
+
* -p path Use path as the full pathname for name (hash -p /path name)
|
|
15
|
+
* -t name Print the remembered location of name
|
|
16
|
+
*/
|
|
17
|
+
import type { ExecResult } from "../../types.js";
|
|
18
|
+
import type { InterpreterContext } from "../types.js";
|
|
19
|
+
export declare function handleHash(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* help - Display helpful information about builtin commands
|
|
3
|
+
*
|
|
4
|
+
* Usage: help [-s] [pattern ...]
|
|
5
|
+
*
|
|
6
|
+
* If PATTERN is specified, gives detailed help on all commands matching PATTERN,
|
|
7
|
+
* otherwise a list of the builtins is printed. The -s option restricts the output
|
|
8
|
+
* for each builtin command matching PATTERN to a short usage synopsis.
|
|
9
|
+
*/
|
|
10
|
+
import type { ExecResult } from "../../types.js";
|
|
11
|
+
import type { InterpreterContext } from "../types.js";
|
|
12
|
+
export declare function handleHelp(_ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -21,11 +21,18 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export { handleBreak } from "./break.js";
|
|
23
23
|
export { handleCd } from "./cd.js";
|
|
24
|
+
export { handleCompgen } from "./compgen.js";
|
|
25
|
+
export { handleComplete } from "./complete.js";
|
|
26
|
+
export { handleCompopt } from "./compopt.js";
|
|
24
27
|
export { handleContinue } from "./continue.js";
|
|
25
|
-
export { handleDeclare, handleReadonly } from "./declare.js";
|
|
28
|
+
export { applyCaseTransform, handleDeclare, handleReadonly, isInteger, } from "./declare.js";
|
|
29
|
+
export { handleDirs, handlePopd, handlePushd } from "./dirs.js";
|
|
26
30
|
export { handleEval } from "./eval.js";
|
|
27
31
|
export { handleExit } from "./exit.js";
|
|
28
32
|
export { handleExport } from "./export.js";
|
|
33
|
+
export { handleGetopts } from "./getopts.js";
|
|
34
|
+
export { handleHash } from "./hash.js";
|
|
35
|
+
export { handleHelp } from "./help.js";
|
|
29
36
|
export { handleLet } from "./let.js";
|
|
30
37
|
export { handleLocal } from "./local.js";
|
|
31
38
|
export { handleMapfile } from "./mapfile.js";
|
|
@@ -35,3 +42,4 @@ export { handleSet } from "./set.js";
|
|
|
35
42
|
export { handleShift } from "./shift.js";
|
|
36
43
|
export { handleSource } from "./source.js";
|
|
37
44
|
export { handleUnset } from "./unset.js";
|
|
45
|
+
export { getLocalVarDepth } from "./variable-assignment.js";
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ExecResult } from "../../types.js";
|
|
5
5
|
import type { InterpreterContext } from "../types.js";
|
|
6
|
-
export declare function handleLocal(ctx: InterpreterContext, args: string[]): ExecResult
|
|
6
|
+
export declare function handleLocal(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ExecResult } from "../../types.js";
|
|
5
5
|
import type { InterpreterContext } from "../types.js";
|
|
6
|
-
export declare function handleRead(ctx: InterpreterContext, args: string[], stdin: string): ExecResult;
|
|
6
|
+
export declare function handleRead(ctx: InterpreterContext, args: string[], stdin: string, stdinSourceFd?: number): ExecResult;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* set - Set/unset shell options builtin
|
|
3
|
+
*
|
|
4
|
+
* In POSIX mode (set -o posix), errors from set (like invalid options)
|
|
5
|
+
* cause the script to exit immediately.
|
|
3
6
|
*/
|
|
4
7
|
import type { ExecResult } from "../../types.js";
|
|
5
8
|
import type { InterpreterContext } from "../types.js";
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* Shifts positional parameters to the left by n (default 1).
|
|
7
7
|
* $n+1 becomes $1, $n+2 becomes $2, etc.
|
|
8
8
|
* $# is decremented by n.
|
|
9
|
+
*
|
|
10
|
+
* In POSIX mode (set -o posix), errors from shift (like shift count
|
|
11
|
+
* exceeding available parameters) cause the script to exit immediately.
|
|
9
12
|
*/
|
|
10
13
|
import type { ExecResult } from "../../types.js";
|
|
11
14
|
import type { InterpreterContext } from "../types.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shopt builtin - Shell options
|
|
3
|
+
* Implements bash's shopt builtin for managing shell-specific options
|
|
4
|
+
*/
|
|
5
|
+
import type { ExecResult } from "../../types.js";
|
|
6
|
+
import type { InterpreterContext } from "../types.js";
|
|
7
|
+
export declare function handleShopt(ctx: InterpreterContext, args: string[]): ExecResult;
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* - unset -v VAR - remove variable (explicit)
|
|
7
7
|
* - unset -f FUNC - remove function
|
|
8
8
|
* - unset 'a[i]' - remove array element (with arithmetic index support)
|
|
9
|
+
*
|
|
10
|
+
* Bash-specific unset scoping:
|
|
11
|
+
* - local-unset (same scope): value-unset - clears value but keeps local cell
|
|
12
|
+
* - dynamic-unset (different scope): cell-unset - removes local cell, exposes outer value
|
|
9
13
|
*/
|
|
10
14
|
import type { ExecResult } from "../../types.js";
|
|
11
15
|
import type { InterpreterContext } from "../types.js";
|
|
12
|
-
export declare function handleUnset(ctx: InterpreterContext, args: string[]): ExecResult
|
|
16
|
+
export declare function handleUnset(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
|