@norskvideo/ctl-dev-kit 0.1.91 → 0.1.93
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.
|
@@ -4,9 +4,18 @@
|
|
|
4
4
|
// question answered first — is this line inside a quoted block or not — so it is
|
|
5
5
|
// asked in one place.
|
|
6
6
|
|
|
7
|
-
/** 1-indexed line numbers inside a multi-line `bash -c '` block, which ends at
|
|
8
|
-
* line
|
|
9
|
-
* opens no block — it is already
|
|
7
|
+
/** 1-indexed line numbers inside a multi-line `bash -c '` block, which ends at
|
|
8
|
+
* the first line whose leading character is the closing `'`. A one-liner
|
|
9
|
+
* closing its own quote (`bash -c 'a; b'`) opens no block — it is already
|
|
10
|
+
* balanced.
|
|
11
|
+
*
|
|
12
|
+
* The close is not always the whole line: smoke.yml ends its block with
|
|
13
|
+
* `' 2>&1 | tee "$RUNNER_TEMP/smoke.log"`, piping the invocation into a log.
|
|
14
|
+
* Requiring the line to be exactly `'` left the block open to end of file, so
|
|
15
|
+
* every apostrophe below it was reported as unquoted shell — comments, and an
|
|
16
|
+
* `if:` expression that is not shell at all. Inside a single-quoted word a
|
|
17
|
+
* leading apostrophe can only be the close, so what follows it on that line is
|
|
18
|
+
* outside the block and none of this guard's business. */
|
|
10
19
|
export function bashBlockLines(yaml: string): Set<number> {
|
|
11
20
|
const OPEN = "bash -c '";
|
|
12
21
|
const inside = new Set<number>();
|
|
@@ -17,7 +26,7 @@ export function bashBlockLines(yaml: string): Set<number> {
|
|
|
17
26
|
if (at >= 0 && !text.slice(at + OPEN.length).includes("'")) open = true;
|
|
18
27
|
return;
|
|
19
28
|
}
|
|
20
|
-
if (text.trim()
|
|
29
|
+
if (text.trim().startsWith("'")) {
|
|
21
30
|
open = false;
|
|
22
31
|
return;
|
|
23
32
|
}
|