just-bash 1.1.0 → 1.2.1
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/dist/Bash.d.ts +18 -0
- package/dist/ai/index.d.ts +6 -1
- package/dist/bin/chunks/awk2-4DKPX43H.js +20 -0
- package/dist/bin/chunks/awk2-6XCE67AX.js +20 -0
- package/dist/bin/chunks/awk2-DKAZ7LPG.js +20 -0
- package/dist/bin/chunks/awk2-GAJ72X3Z.js +20 -0
- package/dist/bin/chunks/awk2-HJAPWU2N.js +18 -0
- package/dist/bin/chunks/awk2-LVXC5OAC.js +20 -0
- package/dist/bin/chunks/awk2-T6HR4EYO.js +20 -0
- package/dist/bin/chunks/awk2-UYU2UYZ2.js +20 -0
- package/dist/bin/chunks/awk2-W64AZN7P.js +20 -0
- package/dist/bin/chunks/chunk-NWWB2XRE.js +6 -0
- package/dist/bin/chunks/find-7BUNQZX4.js +11 -0
- package/dist/bin/chunks/find-YATLECXJ.js +11 -0
- package/dist/bin/chunks/grep-PHBFGJCV.js +15 -0
- package/dist/bin/chunks/sed-B6FXUN7R.js +80 -0
- package/dist/bin/chunks/sed-LTCVBSRV.js +80 -0
- package/dist/bin/chunks/sed-RHLDIXPL.js +76 -0
- package/dist/bin/chunks/sed-SYSATJXR.js +75 -0
- package/dist/bin/just-bash.js +108 -108
- package/dist/bin/shell/chunks/awk2-4DKPX43H.js +20 -0
- package/dist/bin/shell/chunks/awk2-6XCE67AX.js +20 -0
- package/dist/bin/shell/chunks/awk2-DKAZ7LPG.js +20 -0
- package/dist/bin/shell/chunks/awk2-GAJ72X3Z.js +20 -0
- package/dist/bin/shell/chunks/awk2-HJAPWU2N.js +18 -0
- package/dist/bin/shell/chunks/awk2-LVXC5OAC.js +20 -0
- package/dist/bin/shell/chunks/awk2-T6HR4EYO.js +20 -0
- package/dist/bin/shell/chunks/awk2-UYU2UYZ2.js +20 -0
- package/dist/bin/shell/chunks/awk2-W64AZN7P.js +20 -0
- package/dist/bin/shell/chunks/chunk-NWWB2XRE.js +6 -0
- package/dist/bin/shell/chunks/find-7BUNQZX4.js +11 -0
- package/dist/bin/shell/chunks/find-YATLECXJ.js +11 -0
- package/dist/bin/shell/chunks/grep-PHBFGJCV.js +15 -0
- package/dist/bin/shell/chunks/sed-B6FXUN7R.js +80 -0
- package/dist/bin/shell/chunks/sed-LTCVBSRV.js +80 -0
- package/dist/bin/shell/chunks/sed-RHLDIXPL.js +76 -0
- package/dist/bin/shell/chunks/sed-SYSATJXR.js +75 -0
- package/dist/bin/shell/shell.js +116 -120
- package/dist/bundle/ai/index.js +410 -373
- package/dist/bundle/chunks/awk2-365HINHI.js +19 -0
- package/dist/bundle/chunks/awk2-4YCQ6UCB.js +19 -0
- package/dist/bundle/chunks/awk2-7YCFY7D2.js +19 -0
- package/dist/bundle/chunks/awk2-7YL3P4KU.js +19 -0
- package/dist/bundle/chunks/awk2-ETXZHQQ4.js +19 -0
- package/dist/bundle/chunks/awk2-FMEL7ESV.js +19 -0
- package/dist/bundle/chunks/awk2-LE4QUFGK.js +19 -0
- package/dist/bundle/chunks/awk2-MGHA6JPJ.js +17 -0
- package/dist/bundle/chunks/awk2-XEAK5PBN.js +19 -0
- package/dist/bundle/chunks/chunk-CG2HXOFG.js +5 -0
- package/dist/bundle/chunks/find-KP4M5DWC.js +10 -0
- package/dist/bundle/chunks/find-WM6ZETA7.js +10 -0
- package/dist/bundle/chunks/grep-CZTYKNEE.js +14 -0
- package/dist/bundle/chunks/sed-2WWCANZT.js +79 -0
- package/dist/bundle/chunks/sed-5LZHAGFR.js +74 -0
- package/dist/bundle/chunks/sed-IGVS3UIY.js +79 -0
- package/dist/bundle/chunks/sed-V7XSBPTD.js +75 -0
- package/dist/bundle/index.js +111 -111
- package/dist/commands/awk/ast.d.ts +201 -0
- package/dist/commands/awk/awk2.d.ts +7 -0
- package/dist/commands/awk/builtins.d.ts +17 -0
- package/dist/commands/awk/interpreter/context.d.ts +53 -0
- package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
- package/dist/commands/awk/interpreter/fields.d.ts +25 -0
- package/dist/commands/awk/interpreter/helpers.d.ts +29 -0
- package/dist/commands/awk/interpreter/index.d.ts +8 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +50 -0
- package/dist/commands/awk/interpreter/statements.d.ts +11 -0
- package/dist/commands/awk/interpreter/types.d.ts +13 -0
- package/dist/commands/awk/interpreter/variables.d.ts +35 -0
- package/dist/commands/awk/interpreter2.d.ts +90 -0
- package/dist/commands/awk/lexer.d.ts +100 -0
- package/dist/commands/awk/parser2.d.ts +73 -0
- package/dist/commands/find/matcher.d.ts +6 -2
- package/dist/commands/find/types.d.ts +13 -0
- package/dist/commands/sed/executor.d.ts +1 -1
- package/dist/commands/sed/lexer.d.ts +74 -0
- package/dist/commands/sed/parser.d.ts +4 -0
- package/dist/commands/sed/types.d.ts +66 -2
- package/dist/index.d.ts +1 -1
- package/dist/interpreter/errors.d.ts +8 -0
- package/dist/interpreter/types.d.ts +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWK Parser
|
|
3
|
+
*
|
|
4
|
+
* Recursive descent parser that builds an AST from tokens.
|
|
5
|
+
*/
|
|
6
|
+
import type { AwkProgram } from "./ast.js";
|
|
7
|
+
export declare class AwkParser {
|
|
8
|
+
private tokens;
|
|
9
|
+
private pos;
|
|
10
|
+
parse(input: string): AwkProgram;
|
|
11
|
+
private current;
|
|
12
|
+
private advance;
|
|
13
|
+
private match;
|
|
14
|
+
private check;
|
|
15
|
+
private expect;
|
|
16
|
+
private skipNewlines;
|
|
17
|
+
private skipTerminators;
|
|
18
|
+
private parseProgram;
|
|
19
|
+
private parseFunction;
|
|
20
|
+
private parseRule;
|
|
21
|
+
private parseBlock;
|
|
22
|
+
private parseStatement;
|
|
23
|
+
private parseIf;
|
|
24
|
+
private parseWhile;
|
|
25
|
+
private parseDoWhile;
|
|
26
|
+
private parseFor;
|
|
27
|
+
private parsePrint;
|
|
28
|
+
/**
|
|
29
|
+
* Parse a print argument - same as ternary but treats > and >> at the TOP LEVEL
|
|
30
|
+
* (not inside ternary) as redirection rather than comparison operators.
|
|
31
|
+
*/
|
|
32
|
+
private parsePrintArg;
|
|
33
|
+
/**
|
|
34
|
+
* Look ahead to see if there's a ternary ? operator before the next statement terminator.
|
|
35
|
+
* This tells us whether > is comparison (in ternary condition) or redirection.
|
|
36
|
+
*/
|
|
37
|
+
private lookAheadForTernary;
|
|
38
|
+
private parsePrintOr;
|
|
39
|
+
private parsePrintAnd;
|
|
40
|
+
private parsePrintIn;
|
|
41
|
+
private parsePrintMatch;
|
|
42
|
+
/**
|
|
43
|
+
* Like parseComparison but doesn't consume > and >> (for print redirection)
|
|
44
|
+
*/
|
|
45
|
+
private parsePrintComparison;
|
|
46
|
+
private parsePrintf;
|
|
47
|
+
private parseExpression;
|
|
48
|
+
private parseAssignment;
|
|
49
|
+
private parseTernary;
|
|
50
|
+
private parseOr;
|
|
51
|
+
/**
|
|
52
|
+
* Continue parsing a logical OR/AND expression from a given left-hand side.
|
|
53
|
+
* Used when we've already parsed part of an expression (e.g., a regex in pattern context).
|
|
54
|
+
*/
|
|
55
|
+
private parseLogicalOrRest;
|
|
56
|
+
/**
|
|
57
|
+
* Continue parsing a logical AND expression from a given left-hand side.
|
|
58
|
+
*/
|
|
59
|
+
private parseLogicalAndRest;
|
|
60
|
+
private parseAnd;
|
|
61
|
+
private parseIn;
|
|
62
|
+
private parseMatch;
|
|
63
|
+
private parseComparison;
|
|
64
|
+
private parseConcatenation;
|
|
65
|
+
private canStartExpression;
|
|
66
|
+
private isComparisonOrHigherOp;
|
|
67
|
+
private parseAddSub;
|
|
68
|
+
private parseMulDiv;
|
|
69
|
+
private parseUnary;
|
|
70
|
+
private parsePower;
|
|
71
|
+
private parsePostfix;
|
|
72
|
+
private parsePrimary;
|
|
73
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import type { EvalContext, Expression } from "./types.js";
|
|
2
|
-
|
|
1
|
+
import type { EvalContext, EvalResult, Expression } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Evaluate a find expression and return both match result and prune flag.
|
|
4
|
+
* The prune flag is set when -prune is evaluated and returns true.
|
|
5
|
+
*/
|
|
6
|
+
export declare function evaluateExpressionWithPrune(expr: Expression, ctx: EvalContext): EvalResult;
|
|
3
7
|
export declare function collectNewerRefs(expr: Expression | null): string[];
|
|
@@ -6,6 +6,10 @@ export type Expression = {
|
|
|
6
6
|
type: "path";
|
|
7
7
|
pattern: string;
|
|
8
8
|
ignoreCase?: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
type: "regex";
|
|
11
|
+
pattern: string;
|
|
12
|
+
ignoreCase?: boolean;
|
|
9
13
|
} | {
|
|
10
14
|
type: "type";
|
|
11
15
|
fileType: "f" | "d";
|
|
@@ -27,6 +31,10 @@ export type Expression = {
|
|
|
27
31
|
type: "perm";
|
|
28
32
|
mode: number;
|
|
29
33
|
matchType: "exact" | "all" | "any";
|
|
34
|
+
} | {
|
|
35
|
+
type: "prune";
|
|
36
|
+
} | {
|
|
37
|
+
type: "print";
|
|
30
38
|
} | {
|
|
31
39
|
type: "not";
|
|
32
40
|
expr: Expression;
|
|
@@ -62,6 +70,11 @@ export interface EvalContext {
|
|
|
62
70
|
mode: number;
|
|
63
71
|
newerRefTimes: Map<string, number>;
|
|
64
72
|
}
|
|
73
|
+
export interface EvalResult {
|
|
74
|
+
matches: boolean;
|
|
75
|
+
pruned: boolean;
|
|
76
|
+
printed: boolean;
|
|
77
|
+
}
|
|
65
78
|
export interface ParseResult {
|
|
66
79
|
expr: Expression | null;
|
|
67
80
|
pathIndex: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SedCommand, SedExecutionLimits, SedState } from "./types.js";
|
|
2
|
-
export declare function createInitialState(totalLines: number): SedState;
|
|
2
|
+
export declare function createInitialState(totalLines: number, filename?: string, rangeStates?: Map<string, import("./types.js").RangeState>): SedState;
|
|
3
3
|
export interface ExecuteContext {
|
|
4
4
|
lines: string[];
|
|
5
5
|
currentLineIndex: number;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SED Lexer
|
|
3
|
+
*
|
|
4
|
+
* Tokenizes sed scripts into a stream of tokens.
|
|
5
|
+
* Sed has context-sensitive tokenization - the meaning of characters
|
|
6
|
+
* depends heavily on what command is being parsed.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum SedTokenType {
|
|
9
|
+
NUMBER = "NUMBER",
|
|
10
|
+
DOLLAR = "DOLLAR",// $ - last line
|
|
11
|
+
PATTERN = "PATTERN",// /regex/
|
|
12
|
+
STEP = "STEP",// first~step
|
|
13
|
+
LBRACE = "LBRACE",// {
|
|
14
|
+
RBRACE = "RBRACE",// }
|
|
15
|
+
SEMICOLON = "SEMICOLON",// ;
|
|
16
|
+
NEWLINE = "NEWLINE",
|
|
17
|
+
COMMA = "COMMA",// , - address range separator
|
|
18
|
+
COMMAND = "COMMAND",// p, d, h, H, g, G, x, n, N, P, D, q, Q, z, =, l, F, v
|
|
19
|
+
SUBSTITUTE = "SUBSTITUTE",// s/pattern/replacement/flags
|
|
20
|
+
TRANSLITERATE = "TRANSLITERATE",// y/source/dest/
|
|
21
|
+
LABEL_DEF = "LABEL_DEF",// :name
|
|
22
|
+
BRANCH = "BRANCH",// b [label]
|
|
23
|
+
BRANCH_ON_SUBST = "BRANCH_ON_SUBST",// t [label]
|
|
24
|
+
BRANCH_ON_NO_SUBST = "BRANCH_ON_NO_SUBST",// T [label]
|
|
25
|
+
TEXT_CMD = "TEXT_CMD",// a\, i\, c\ with text
|
|
26
|
+
FILE_READ = "FILE_READ",// r filename
|
|
27
|
+
FILE_READ_LINE = "FILE_READ_LINE",// R filename
|
|
28
|
+
FILE_WRITE = "FILE_WRITE",// w filename
|
|
29
|
+
FILE_WRITE_LINE = "FILE_WRITE_LINE",// W filename
|
|
30
|
+
EXECUTE = "EXECUTE",// e [command]
|
|
31
|
+
EOF = "EOF",
|
|
32
|
+
ERROR = "ERROR"
|
|
33
|
+
}
|
|
34
|
+
export interface SedToken {
|
|
35
|
+
type: SedTokenType;
|
|
36
|
+
value: string | number;
|
|
37
|
+
pattern?: string;
|
|
38
|
+
replacement?: string;
|
|
39
|
+
flags?: string;
|
|
40
|
+
source?: string;
|
|
41
|
+
dest?: string;
|
|
42
|
+
text?: string;
|
|
43
|
+
label?: string;
|
|
44
|
+
filename?: string;
|
|
45
|
+
command?: string;
|
|
46
|
+
first?: number;
|
|
47
|
+
step?: number;
|
|
48
|
+
line: number;
|
|
49
|
+
column: number;
|
|
50
|
+
}
|
|
51
|
+
export declare class SedLexer {
|
|
52
|
+
private input;
|
|
53
|
+
private pos;
|
|
54
|
+
private line;
|
|
55
|
+
private column;
|
|
56
|
+
constructor(input: string);
|
|
57
|
+
tokenize(): SedToken[];
|
|
58
|
+
private makeToken;
|
|
59
|
+
private peek;
|
|
60
|
+
private advance;
|
|
61
|
+
private skipWhitespace;
|
|
62
|
+
private nextToken;
|
|
63
|
+
private readNumber;
|
|
64
|
+
private readPattern;
|
|
65
|
+
private readLabelDef;
|
|
66
|
+
private readCommand;
|
|
67
|
+
private readSubstitute;
|
|
68
|
+
private readTransliterate;
|
|
69
|
+
private readTextCommand;
|
|
70
|
+
private readBranch;
|
|
71
|
+
private readFileCommand;
|
|
72
|
+
private readExecute;
|
|
73
|
+
private isDigit;
|
|
74
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { SedCommand } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parse multiple sed scripts into a list of commands.
|
|
4
|
+
* This is the main entry point for parsing sed scripts.
|
|
5
|
+
*/
|
|
2
6
|
export declare function parseMultipleScripts(scripts: string[], extendedRegex?: boolean): {
|
|
3
7
|
commands: SedCommand[];
|
|
4
8
|
error?: string;
|
|
@@ -9,7 +9,7 @@ export interface AddressRange {
|
|
|
9
9
|
start?: SedAddress;
|
|
10
10
|
end?: SedAddress;
|
|
11
11
|
}
|
|
12
|
-
export type SedCommandType = "substitute" | "print" | "printFirstLine" | "delete" | "deleteFirstLine" | "append" | "insert" | "change" | "hold" | "holdAppend" | "get" | "getAppend" | "exchange" | "next" | "nextAppend" | "quit" | "transliterate" | "lineNumber" | "branch" | "branchOnSubst" | "branchOnNoSubst" | "label" | "zap" | "group";
|
|
12
|
+
export type SedCommandType = "substitute" | "print" | "printFirstLine" | "delete" | "deleteFirstLine" | "append" | "insert" | "change" | "hold" | "holdAppend" | "get" | "getAppend" | "exchange" | "next" | "nextAppend" | "quit" | "quitSilent" | "transliterate" | "lineNumber" | "branch" | "branchOnSubst" | "branchOnNoSubst" | "label" | "zap" | "group" | "list" | "printFilename" | "version" | "readFile" | "readFileLine" | "writeFile" | "writeFirstLine" | "execute";
|
|
13
13
|
export interface SubstituteCommand {
|
|
14
14
|
type: "substitute";
|
|
15
15
|
address?: AddressRange;
|
|
@@ -71,6 +71,12 @@ export interface NextCommand {
|
|
|
71
71
|
export interface QuitCommand {
|
|
72
72
|
type: "quit";
|
|
73
73
|
address?: AddressRange;
|
|
74
|
+
exitCode?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface QuitSilentCommand {
|
|
77
|
+
type: "quitSilent";
|
|
78
|
+
address?: AddressRange;
|
|
79
|
+
exitCode?: number;
|
|
74
80
|
}
|
|
75
81
|
export interface NextAppendCommand {
|
|
76
82
|
type: "nextAppend";
|
|
@@ -122,7 +128,45 @@ export interface GroupCommand {
|
|
|
122
128
|
address?: AddressRange;
|
|
123
129
|
commands: SedCommand[];
|
|
124
130
|
}
|
|
125
|
-
export
|
|
131
|
+
export interface ListCommand {
|
|
132
|
+
type: "list";
|
|
133
|
+
address?: AddressRange;
|
|
134
|
+
}
|
|
135
|
+
export interface PrintFilenameCommand {
|
|
136
|
+
type: "printFilename";
|
|
137
|
+
address?: AddressRange;
|
|
138
|
+
}
|
|
139
|
+
export interface VersionCommand {
|
|
140
|
+
type: "version";
|
|
141
|
+
address?: AddressRange;
|
|
142
|
+
minVersion?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ReadFileCommand {
|
|
145
|
+
type: "readFile";
|
|
146
|
+
address?: AddressRange;
|
|
147
|
+
filename: string;
|
|
148
|
+
}
|
|
149
|
+
export interface ReadFileLineCommand {
|
|
150
|
+
type: "readFileLine";
|
|
151
|
+
address?: AddressRange;
|
|
152
|
+
filename: string;
|
|
153
|
+
}
|
|
154
|
+
export interface WriteFileCommand {
|
|
155
|
+
type: "writeFile";
|
|
156
|
+
address?: AddressRange;
|
|
157
|
+
filename: string;
|
|
158
|
+
}
|
|
159
|
+
export interface WriteFirstLineCommand {
|
|
160
|
+
type: "writeFirstLine";
|
|
161
|
+
address?: AddressRange;
|
|
162
|
+
filename: string;
|
|
163
|
+
}
|
|
164
|
+
export interface ExecuteCommand {
|
|
165
|
+
type: "execute";
|
|
166
|
+
address?: AddressRange;
|
|
167
|
+
command?: string;
|
|
168
|
+
}
|
|
169
|
+
export type SedCommand = SubstituteCommand | PrintCommand | PrintFirstLineCommand | DeleteCommand | DeleteFirstLineCommand | AppendCommand | InsertCommand | ChangeCommand | HoldCommand | HoldAppendCommand | GetCommand | GetAppendCommand | ExchangeCommand | NextCommand | QuitCommand | QuitSilentCommand | NextAppendCommand | TransliterateCommand | LineNumberCommand | BranchCommand | BranchOnSubstCommand | BranchOnNoSubstCommand | LabelCommand | ZapCommand | GroupCommand | ListCommand | PrintFilenameCommand | VersionCommand | ReadFileCommand | ReadFileLineCommand | WriteFileCommand | WriteFirstLineCommand | ExecuteCommand;
|
|
126
170
|
export interface SedState {
|
|
127
171
|
patternSpace: string;
|
|
128
172
|
holdSpace: string;
|
|
@@ -131,10 +175,30 @@ export interface SedState {
|
|
|
131
175
|
deleted: boolean;
|
|
132
176
|
printed: boolean;
|
|
133
177
|
quit: boolean;
|
|
178
|
+
quitSilent: boolean;
|
|
179
|
+
exitCode?: number;
|
|
134
180
|
appendBuffer: string[];
|
|
135
181
|
substitutionMade: boolean;
|
|
136
182
|
lineNumberOutput: string[];
|
|
137
183
|
restartCycle: boolean;
|
|
184
|
+
currentFilename?: string;
|
|
185
|
+
pendingFileReads: Array<{
|
|
186
|
+
filename: string;
|
|
187
|
+
wholeFile: boolean;
|
|
188
|
+
}>;
|
|
189
|
+
pendingFileWrites: Array<{
|
|
190
|
+
filename: string;
|
|
191
|
+
content: string;
|
|
192
|
+
}>;
|
|
193
|
+
pendingExecute?: {
|
|
194
|
+
command: string;
|
|
195
|
+
replacePattern: boolean;
|
|
196
|
+
};
|
|
197
|
+
rangeStates: Map<string, RangeState>;
|
|
198
|
+
}
|
|
199
|
+
export interface RangeState {
|
|
200
|
+
active: boolean;
|
|
201
|
+
startLine?: number;
|
|
138
202
|
}
|
|
139
203
|
export interface SedExecutionLimits {
|
|
140
204
|
maxIterations: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { BashOptions, ExecOptions } from "./Bash.js";
|
|
1
|
+
export type { BashLogger, BashOptions, ExecOptions } from "./Bash.js";
|
|
2
2
|
export { Bash } from "./Bash.js";
|
|
3
3
|
export type { AllCommandName, CommandName, NetworkCommandName, } from "./commands/registry.js";
|
|
4
4
|
export { getCommandNames, getNetworkCommandNames, } from "./commands/registry.js";
|
|
@@ -99,6 +99,14 @@ export declare class ExecutionLimitError extends ControlFlowError {
|
|
|
99
99
|
static readonly EXIT_CODE = 126;
|
|
100
100
|
constructor(message: string, limitType: "recursion" | "commands" | "iterations", stdout?: string, stderr?: string);
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Error thrown when break/continue is called in a subshell that was
|
|
104
|
+
* spawned from within a loop context. Causes the subshell to exit cleanly.
|
|
105
|
+
*/
|
|
106
|
+
export declare class SubshellExitError extends ControlFlowError {
|
|
107
|
+
readonly name = "SubshellExitError";
|
|
108
|
+
constructor(stdout?: string, stderr?: string);
|
|
109
|
+
}
|
|
102
110
|
/**
|
|
103
111
|
* Type guard for errors that exit the current scope (return, break, continue).
|
|
104
112
|
* These need special handling vs errexit/nounset which terminate execution.
|
|
@@ -37,6 +37,8 @@ export interface InterpreterState {
|
|
|
37
37
|
inCondition: boolean;
|
|
38
38
|
/** Current loop nesting depth (for break/continue) */
|
|
39
39
|
loopDepth: number;
|
|
40
|
+
/** True if this subshell was spawned from within a loop context (for break/continue to exit subshell) */
|
|
41
|
+
parentHasLoopContext?: boolean;
|
|
40
42
|
/** Stdin available for commands in compound commands (groups, subshells, while loops with piped input) */
|
|
41
43
|
groupStdin?: string;
|
|
42
44
|
/** Set of variable names that are readonly */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "just-bash",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A simulated bash environment with virtual filesystem",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"test:dist": "vitest run src/cli/just-bash.bundle.test.ts",
|
|
98
98
|
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
99
99
|
"test:comparison": "vitest run --config vitest.comparison.config.ts",
|
|
100
|
+
"test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
|
|
100
101
|
"shell": "npx tsx src/cli/shell.ts",
|
|
101
102
|
"dev:exec": "npx tsx src/cli/exec.ts"
|
|
102
103
|
}
|