@oneie/cli 5.5.0 → 5.5.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/package.json +1 -1
- package/dist/src/lib/client.d.ts +5 -1
- package/dist/src/lib/client.js +7 -2
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/src/lib/client.d.ts
CHANGED
|
@@ -12,5 +12,9 @@ export declare function authHeaders(opts?: {
|
|
|
12
12
|
}): Record<string, string>;
|
|
13
13
|
/** Walks cmd.parent all the way to root — never a fixed depth. ONEIE_JSON env is retired. */
|
|
14
14
|
export declare function jsonMode(cmd: Command): boolean;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* ok/error human line (`ok k=v k=v`), or the same data as one JSON line under --json.
|
|
17
|
+
* `ok: false` exits 1 in BOTH modes — the JSON line is for the pipeline, the exit
|
|
18
|
+
* code for `$?`; 5.5.0 skipped it under --json and a refusal read as success.
|
|
19
|
+
*/
|
|
16
20
|
export declare function out(cmd: Command, data: Record<string, unknown>): void;
|
package/dist/src/lib/client.js
CHANGED
|
@@ -48,15 +48,20 @@ export function jsonMode(cmd) {
|
|
|
48
48
|
}
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* ok/error human line (`ok k=v k=v`), or the same data as one JSON line under --json.
|
|
53
|
+
* `ok: false` exits 1 in BOTH modes — the JSON line is for the pipeline, the exit
|
|
54
|
+
* code for `$?`; 5.5.0 skipped it under --json and a refusal read as success.
|
|
55
|
+
*/
|
|
52
56
|
export function out(cmd, data) {
|
|
57
|
+
if (data.ok === false)
|
|
58
|
+
process.exitCode = 1;
|
|
53
59
|
if (jsonMode(cmd)) {
|
|
54
60
|
process.stdout.write(JSON.stringify(data) + '\n');
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
63
|
if (data.ok === false) {
|
|
58
64
|
process.stderr.write(`error ${data.error ?? 'unknown'}\n`);
|
|
59
|
-
process.exitCode = 1;
|
|
60
65
|
return;
|
|
61
66
|
}
|
|
62
67
|
const pairs = Object.entries(data)
|