xcstrings-cli 1.1.1 → 1.2.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 +41 -26
- package/dist/index.js +307 -286
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,13 +22,13 @@ Check it out here: [xcstrings-cli Helper](https://chatgpt.com/g/g-69365945f8bc81
|
|
|
22
22
|
npm install -g xcstrings-cli
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
2. Initialize xcstrings-cli
|
|
25
|
+
2. Initialize xcstrings-cli:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
xcstrings init
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
This will ask you some questions and create
|
|
31
|
+
This will ask you some questions and create an `xcstrings-cli.json` file in the current directory.
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
@@ -40,9 +40,9 @@ xcstrings add \
|
|
|
40
40
|
--comment "Hello, World" \
|
|
41
41
|
--strings << EOF
|
|
42
42
|
{
|
|
43
|
-
"ja": "
|
|
43
|
+
"ja": "こんにちは、世界。",
|
|
44
44
|
"en": "Hello, World.",
|
|
45
|
-
"zh-Hans": "
|
|
45
|
+
"zh-Hans": "你好,世界。"
|
|
46
46
|
}
|
|
47
47
|
EOF
|
|
48
48
|
```
|
|
@@ -53,9 +53,9 @@ EOF
|
|
|
53
53
|
xcstrings remove --key greeting
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
List supported languages:**
|
|
56
|
+
**List supported languages:**
|
|
57
57
|
|
|
58
|
-
This command lists all languages by checking xcstrings files and your Xcode project settings (`.pbxproj` specified in the config
|
|
58
|
+
This command lists all languages by checking xcstrings files and your Xcode project settings (`.pbxproj` specified in the config file as `xcodeprojPaths`).
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
xcstrings languages
|
|
@@ -66,28 +66,35 @@ You can use `xcstrings --help` or `xcstrings <sub-command> --help` to see the li
|
|
|
66
66
|
|
|
67
67
|
## Command options
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
* `--help, -h`: `boolean` (Optional)
|
|
70
|
+
|
|
71
|
+
* Show help.
|
|
72
|
+
* `--version, -v`: `boolean` (Optional)
|
|
73
|
+
|
|
74
|
+
* Show version.
|
|
75
|
+
* `--config`: `string` (Optional)
|
|
76
|
+
|
|
77
|
+
* The custom config file path. If not specified, xcstrings-cli will look for `xcstrings-cli.json` or `xcstrings-cli.json5` in the current folder or its parent folders until the root.
|
|
75
78
|
|
|
76
79
|
### `add` command options
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
* `--strings, -s`: `string | string[] | { [key: string]: string }` (Required)
|
|
82
|
+
|
|
83
|
+
* The strings to add or update.
|
|
84
|
+
* If only one string is provided, xcstrings-cli will use it as the default string.
|
|
85
|
+
* `--comment, -c`: `string` (Optional)
|
|
86
|
+
|
|
87
|
+
* The comment for the string to add, intended for translators.
|
|
88
|
+
* `--extractionState, -e`: `string` (Optional, default: `manual`)
|
|
89
|
+
|
|
90
|
+
* The extraction state of the string to add: `translated` or `manual`.
|
|
91
|
+
* `--help`: `boolean` (Optional)
|
|
92
|
+
|
|
93
|
+
* Show help.
|
|
87
94
|
|
|
88
95
|
## Config file
|
|
89
96
|
|
|
90
|
-
Put
|
|
97
|
+
Put an `xcstrings-cli.json5` or `xcstrings-cli.json` file in the project root, and xcstrings-cli will use it as the config file.
|
|
91
98
|
|
|
92
99
|
```json5
|
|
93
100
|
{
|
|
@@ -106,10 +113,18 @@ Put a `xcstrings-cli.json5` or `xcstrings-cli.json` file in the project root, th
|
|
|
106
113
|
|
|
107
114
|
These are the options for the config file:
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
* **xcstringsPaths**: `string[] | { alias: string, path: string }[]`
|
|
117
|
+
|
|
118
|
+
* If only one path is provided, xcstrings-cli will use it as the default xcstrings file.
|
|
119
|
+
* If multiple paths are provided, xcstrings-cli will ask you to select an xcstrings file.
|
|
120
|
+
* **xcodeprojPaths**: `string[]` (Optional)
|
|
121
|
+
|
|
122
|
+
* Paths to Xcode project files used to detect supported languages.
|
|
123
|
+
* If not specified, xcstrings-cli will not check the supported languages in your Xcode project.
|
|
124
|
+
* **missingLanguagePolicy**: `string` (Optional, default: `ignore`)
|
|
125
|
+
* How to handle translations for languages that are not included in the `xcstrings languages` output when adding strings. Options are:
|
|
126
|
+
* `ignore`: Only add translations for languages included in the `xcstrings languages` output.
|
|
127
|
+
* `add`: Add translations anyway.
|
|
113
128
|
|
|
114
129
|
## LICENSE
|
|
115
130
|
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { hideBin as
|
|
4
|
-
import { readFile as
|
|
5
|
-
import {
|
|
2
|
+
import ve from "yargs";
|
|
3
|
+
import { hideBin as je } from "yargs/helpers";
|
|
4
|
+
import { readFile as Oe, writeFile as ae, readdir as ce } from "node:fs/promises";
|
|
5
|
+
import { cosmiconfig as xe } from "cosmiconfig";
|
|
6
|
+
import Se from "json5";
|
|
7
|
+
import { XcodeProject as ke } from "@bacons/xcode";
|
|
8
|
+
import { resolve as X, relative as V } from "node:path";
|
|
6
9
|
import d from "chalk";
|
|
7
|
-
import { checkbox as
|
|
8
|
-
import { XcodeProject as Se } from "@bacons/xcode";
|
|
9
|
-
import { cosmiconfig as ke } from "cosmiconfig";
|
|
10
|
-
import ze from "json5";
|
|
10
|
+
import { checkbox as ne, confirm as ze, select as Ee } from "@inquirer/prompts";
|
|
11
11
|
async function U(t) {
|
|
12
|
-
const r = await
|
|
12
|
+
const r = await Oe(t, "utf-8");
|
|
13
13
|
return JSON.parse(r);
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
16
|
-
const n = JSON.stringify(r, null, 2),
|
|
17
|
-
await
|
|
15
|
+
async function le(t, r) {
|
|
16
|
+
const n = JSON.stringify(r, null, 2), o = _e(n);
|
|
17
|
+
await ae(t, o + `
|
|
18
18
|
`, "utf-8");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
let r = "", n = !1,
|
|
20
|
+
function _e(t) {
|
|
21
|
+
let r = "", n = !1, o = !1;
|
|
22
22
|
for (let c = 0; c < t.length; c++) {
|
|
23
23
|
const l = t[c];
|
|
24
|
-
if (n && l === "\\" && !
|
|
25
|
-
|
|
24
|
+
if (n && l === "\\" && !o) {
|
|
25
|
+
o = !0, r += l;
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (o) {
|
|
29
|
+
o = !1, r += l;
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
32
|
if (l === '"') {
|
|
@@ -41,73 +41,120 @@ function Ee(t) {
|
|
|
41
41
|
}
|
|
42
42
|
return r;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const M = "xcstrings-cli", re = xe(M, {
|
|
45
|
+
searchPlaces: [
|
|
46
|
+
`${M}.json`,
|
|
47
|
+
`${M}.json5`
|
|
48
|
+
],
|
|
49
|
+
loaders: {
|
|
50
|
+
".json5": async (t, r) => Se.parse(r)
|
|
51
|
+
},
|
|
52
|
+
cache: !1
|
|
53
|
+
});
|
|
54
|
+
async function H(t) {
|
|
55
|
+
if (t) {
|
|
56
|
+
const n = await re.load(t);
|
|
57
|
+
return n ? n.config : null;
|
|
58
|
+
}
|
|
59
|
+
const r = await re.search();
|
|
60
|
+
return r ? r.config : null;
|
|
61
|
+
}
|
|
62
|
+
function Le(t) {
|
|
63
|
+
const r = X(t, "project.pbxproj");
|
|
64
|
+
return ke.open(r).rootObject.props.knownRegions ?? [];
|
|
65
|
+
}
|
|
66
|
+
async function Pe(t) {
|
|
67
|
+
const r = await U(t), n = /* @__PURE__ */ new Set();
|
|
68
|
+
for (const o of Object.keys(r.strings)) {
|
|
69
|
+
const c = r.strings[o];
|
|
70
|
+
if (c.localizations)
|
|
71
|
+
for (const l of Object.keys(c.localizations))
|
|
72
|
+
n.add(l);
|
|
73
|
+
}
|
|
74
|
+
return Array.from(n).sort();
|
|
75
|
+
}
|
|
76
|
+
async function fe(t, r) {
|
|
77
|
+
const n = await H(r);
|
|
78
|
+
if (n?.xcodeprojPaths && n.xcodeprojPaths.length > 0) {
|
|
79
|
+
const o = /* @__PURE__ */ new Set();
|
|
80
|
+
for (const c of n.xcodeprojPaths)
|
|
81
|
+
Le(c).forEach((v) => o.add(v));
|
|
82
|
+
return Array.from(o).sort();
|
|
83
|
+
}
|
|
84
|
+
return await Pe(t);
|
|
85
|
+
}
|
|
86
|
+
async function Fe(t, r, n, o, c) {
|
|
87
|
+
const l = await U(t);
|
|
88
|
+
l.strings || (l.strings = {});
|
|
89
|
+
const v = {
|
|
90
|
+
...l.strings[r],
|
|
49
91
|
extractionState: "manual"
|
|
50
92
|
};
|
|
51
|
-
if (n && (
|
|
52
|
-
|
|
53
|
-
for (const [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
93
|
+
if (n && (v.comment = n), o) {
|
|
94
|
+
const E = (await H(c))?.missingLanguagePolicy || "skip", w = await fe(t, c), m = [];
|
|
95
|
+
for (const [b, p] of Object.entries(o))
|
|
96
|
+
(w.includes(b) || E === "include") && m.push([b, p]);
|
|
97
|
+
if (m.length > 0) {
|
|
98
|
+
v.localizations = v.localizations || {};
|
|
99
|
+
for (const [b, p] of m)
|
|
100
|
+
v.localizations[b] = {
|
|
101
|
+
stringUnit: {
|
|
102
|
+
state: "translated",
|
|
103
|
+
value: p
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
60
107
|
}
|
|
61
|
-
|
|
108
|
+
l.strings[r] = v, await le(t, l);
|
|
62
109
|
}
|
|
63
|
-
async function
|
|
110
|
+
async function Ce(t, r) {
|
|
64
111
|
const n = await U(t);
|
|
65
|
-
n.strings && n.strings[r] && (delete n.strings[r], await
|
|
112
|
+
n.strings && n.strings[r] && (delete n.strings[r], await le(t, n));
|
|
66
113
|
}
|
|
67
|
-
const
|
|
68
|
-
async function
|
|
114
|
+
const B = "xcstrings-cli.json5";
|
|
115
|
+
async function Te(t) {
|
|
69
116
|
const r = [];
|
|
70
|
-
async function n(
|
|
117
|
+
async function n(o) {
|
|
71
118
|
try {
|
|
72
|
-
const c = await
|
|
119
|
+
const c = await ce(o, { withFileTypes: !0 });
|
|
73
120
|
for (const l of c) {
|
|
74
|
-
const
|
|
75
|
-
l.isDirectory() ? !l.name.startsWith(".") && l.name !== "node_modules" && await n(
|
|
121
|
+
const v = X(o, l.name);
|
|
122
|
+
l.isDirectory() ? !l.name.startsWith(".") && l.name !== "node_modules" && await n(v) : l.name.endsWith(".xcstrings") && r.push(v);
|
|
76
123
|
}
|
|
77
124
|
} catch {
|
|
78
125
|
}
|
|
79
126
|
}
|
|
80
127
|
return await n(t), r;
|
|
81
128
|
}
|
|
82
|
-
async function
|
|
129
|
+
async function $e(t) {
|
|
83
130
|
const r = [];
|
|
84
131
|
let n = t;
|
|
85
132
|
try {
|
|
86
|
-
const
|
|
87
|
-
for (const c of
|
|
88
|
-
c.isDirectory() && c.name.endsWith(".xcodeproj") && r.push(
|
|
133
|
+
const o = await ce(n, { withFileTypes: !0 });
|
|
134
|
+
for (const c of o)
|
|
135
|
+
c.isDirectory() && c.name.endsWith(".xcodeproj") && r.push(X(n, c.name));
|
|
89
136
|
} catch {
|
|
90
137
|
}
|
|
91
138
|
return r;
|
|
92
139
|
}
|
|
93
|
-
async function
|
|
140
|
+
async function Ae() {
|
|
94
141
|
const t = process.cwd();
|
|
95
142
|
console.log(), console.log(d.bold.cyan("🚀 xcstrings-cli Configuration Setup")), console.log(d.dim("─".repeat(40))), console.log(), console.log(d.yellow("🔍 Searching for .xcstrings files..."));
|
|
96
|
-
const r = await
|
|
143
|
+
const r = await Te(t);
|
|
97
144
|
console.log(d.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
98
|
-
const n = await
|
|
145
|
+
const n = await $e(t);
|
|
99
146
|
console.log();
|
|
100
|
-
let
|
|
147
|
+
let o = [];
|
|
101
148
|
if (r.length > 0) {
|
|
102
149
|
console.log(d.green(`✓ Found ${r.length} .xcstrings file(s)`));
|
|
103
|
-
const
|
|
104
|
-
name: d.white(
|
|
105
|
-
value:
|
|
150
|
+
const w = r.map((m) => ({
|
|
151
|
+
name: d.white(V(t, m)) + d.dim(` (${m})`),
|
|
152
|
+
value: V(t, m),
|
|
106
153
|
checked: !0
|
|
107
154
|
}));
|
|
108
|
-
|
|
155
|
+
o = await ne({
|
|
109
156
|
message: d.bold("Select .xcstrings files to manage:"),
|
|
110
|
-
choices:
|
|
157
|
+
choices: w
|
|
111
158
|
});
|
|
112
159
|
} else
|
|
113
160
|
console.log(d.dim(" No .xcstrings files found in current directory"));
|
|
@@ -115,88 +162,48 @@ async function Ce() {
|
|
|
115
162
|
let c = [];
|
|
116
163
|
if (n.length > 0) {
|
|
117
164
|
console.log(d.green(`✓ Found ${n.length} .xcodeproj director${n.length === 1 ? "y" : "ies"}`));
|
|
118
|
-
const
|
|
119
|
-
name: d.white(
|
|
120
|
-
value:
|
|
165
|
+
const w = n.map((m) => ({
|
|
166
|
+
name: d.white(V(t, m) || m) + d.dim(` (${m})`),
|
|
167
|
+
value: V(t, m) || m,
|
|
121
168
|
checked: !0
|
|
122
169
|
}));
|
|
123
|
-
c = await
|
|
170
|
+
c = await ne({
|
|
124
171
|
message: d.bold("Select .xcodeproj directories for language detection:"),
|
|
125
|
-
choices:
|
|
172
|
+
choices: w
|
|
126
173
|
});
|
|
127
174
|
} else
|
|
128
175
|
console.log(d.dim(" No .xcodeproj directories found"));
|
|
129
|
-
if (console.log(), console.log(d.dim("─".repeat(40))), console.log(), console.log(d.bold("📋 Configuration Summary:")), console.log(), console.log(d.cyan(" xcstringsPaths:")),
|
|
130
|
-
message: d.bold(`Create ${d.yellow(
|
|
176
|
+
if (console.log(), console.log(d.dim("─".repeat(40))), console.log(), console.log(d.bold("📋 Configuration Summary:")), console.log(), console.log(d.cyan(" xcstringsPaths:")), o.length > 0 ? o.forEach((w) => console.log(d.white(` • ${w}`))) : console.log(d.dim(" (none)")), console.log(), console.log(d.cyan(" xcodeprojPaths:")), c.length > 0 ? c.forEach((w) => console.log(d.white(` • ${w}`))) : console.log(d.dim(" (none)")), console.log(), !await ze({
|
|
177
|
+
message: d.bold(`Create ${d.yellow(B)}?`),
|
|
131
178
|
default: !0
|
|
132
179
|
})) {
|
|
133
180
|
console.log(d.dim(" Configuration cancelled."));
|
|
134
181
|
return;
|
|
135
182
|
}
|
|
136
|
-
const
|
|
137
|
-
`), z = c.map((
|
|
138
|
-
`),
|
|
183
|
+
const v = o.map((w) => ` "${w}"`).join(`,
|
|
184
|
+
`), z = c.map((w) => ` "${w}"`).join(`,
|
|
185
|
+
`), E = `{
|
|
139
186
|
// Array of paths to .xcstrings files to manage. Specify relative or absolute paths.
|
|
140
187
|
xcstringsPaths: [
|
|
141
|
-
${
|
|
188
|
+
${v}
|
|
142
189
|
],
|
|
143
190
|
// Array of paths to .xcodeproj directories. Used for discovering supported languages.
|
|
144
191
|
xcodeprojPaths: [
|
|
145
192
|
${z}
|
|
146
|
-
]
|
|
193
|
+
],
|
|
194
|
+
// Behavior for handling missing languages when adding strings.
|
|
195
|
+
missingLanguagePolicy: "skip",
|
|
147
196
|
}
|
|
148
197
|
`;
|
|
149
|
-
await
|
|
150
|
-
}
|
|
151
|
-
const M = "xcstrings-cli", ne = ke(M, {
|
|
152
|
-
searchPlaces: [
|
|
153
|
-
`${M}.json`,
|
|
154
|
-
`${M}.json5`
|
|
155
|
-
],
|
|
156
|
-
loaders: {
|
|
157
|
-
".json5": async (t, r) => ze.parse(r)
|
|
158
|
-
},
|
|
159
|
-
cache: !1
|
|
160
|
-
});
|
|
161
|
-
async function le(t) {
|
|
162
|
-
if (t) {
|
|
163
|
-
const n = await ne.load(t);
|
|
164
|
-
return n ? n.config : null;
|
|
165
|
-
}
|
|
166
|
-
const r = await ne.search();
|
|
167
|
-
return r ? r.config : null;
|
|
168
|
-
}
|
|
169
|
-
function Te(t) {
|
|
170
|
-
const r = D(t, "project.pbxproj");
|
|
171
|
-
return Se.open(r).rootObject.props.knownRegions ?? [];
|
|
172
|
-
}
|
|
173
|
-
async function $e(t) {
|
|
174
|
-
const r = await U(t), n = /* @__PURE__ */ new Set();
|
|
175
|
-
for (const s of Object.keys(r.strings)) {
|
|
176
|
-
const c = r.strings[s];
|
|
177
|
-
if (c.localizations)
|
|
178
|
-
for (const l of Object.keys(c.localizations))
|
|
179
|
-
n.add(l);
|
|
180
|
-
}
|
|
181
|
-
return Array.from(n).sort();
|
|
182
|
-
}
|
|
183
|
-
async function Ae(t, r) {
|
|
184
|
-
const n = await le(r);
|
|
185
|
-
if (n?.xcodeprojPaths && n.xcodeprojPaths.length > 0) {
|
|
186
|
-
const s = /* @__PURE__ */ new Set();
|
|
187
|
-
for (const c of n.xcodeprojPaths)
|
|
188
|
-
Te(c).forEach((x) => s.add(x));
|
|
189
|
-
return Array.from(s).sort();
|
|
190
|
-
}
|
|
191
|
-
return await $e(t);
|
|
198
|
+
await ae(B, E, "utf-8"), console.log(), console.log(d.bold.green(`✓ Created ${B}`)), console.log(d.dim(` Run ${d.cyan("xcstrings --help")} to see available commands.`)), console.log();
|
|
192
199
|
}
|
|
193
200
|
function Ne(t) {
|
|
194
201
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
195
202
|
}
|
|
196
|
-
var C = { exports: {} },
|
|
197
|
-
function
|
|
198
|
-
if (
|
|
199
|
-
|
|
203
|
+
var C = { exports: {} }, I, se;
|
|
204
|
+
function Re() {
|
|
205
|
+
if (se) return I;
|
|
206
|
+
se = 1;
|
|
200
207
|
function t(n) {
|
|
201
208
|
try {
|
|
202
209
|
return JSON.stringify(n);
|
|
@@ -204,77 +211,77 @@ function Ve() {
|
|
|
204
211
|
return '"[Circular]"';
|
|
205
212
|
}
|
|
206
213
|
}
|
|
207
|
-
|
|
208
|
-
function r(n,
|
|
209
|
-
var l = c && c.stringify || t,
|
|
214
|
+
I = r;
|
|
215
|
+
function r(n, o, c) {
|
|
216
|
+
var l = c && c.stringify || t, v = 1;
|
|
210
217
|
if (typeof n == "object" && n !== null) {
|
|
211
|
-
var z =
|
|
218
|
+
var z = o.length + v;
|
|
212
219
|
if (z === 1) return n;
|
|
213
|
-
var
|
|
214
|
-
|
|
215
|
-
for (var
|
|
216
|
-
|
|
217
|
-
return
|
|
220
|
+
var E = new Array(z);
|
|
221
|
+
E[0] = l(n);
|
|
222
|
+
for (var w = 1; w < z; w++)
|
|
223
|
+
E[w] = l(o[w]);
|
|
224
|
+
return E.join(" ");
|
|
218
225
|
}
|
|
219
226
|
if (typeof n != "string")
|
|
220
227
|
return n;
|
|
221
|
-
var
|
|
222
|
-
if (
|
|
223
|
-
for (var
|
|
228
|
+
var m = o.length;
|
|
229
|
+
if (m === 0) return n;
|
|
230
|
+
for (var b = "", p = 1 - v, h = -1, k = n && n.length || 0, f = 0; f < k; ) {
|
|
224
231
|
if (n.charCodeAt(f) === 37 && f + 1 < k) {
|
|
225
|
-
switch (
|
|
232
|
+
switch (h = h > -1 ? h : 0, n.charCodeAt(f + 1)) {
|
|
226
233
|
case 100:
|
|
227
234
|
// 'd'
|
|
228
235
|
case 102:
|
|
229
|
-
if (
|
|
230
|
-
|
|
236
|
+
if (p >= m || o[p] == null) break;
|
|
237
|
+
h < f && (b += n.slice(h, f)), b += Number(o[p]), h = f + 2, f++;
|
|
231
238
|
break;
|
|
232
239
|
case 105:
|
|
233
|
-
if (
|
|
234
|
-
|
|
240
|
+
if (p >= m || o[p] == null) break;
|
|
241
|
+
h < f && (b += n.slice(h, f)), b += Math.floor(Number(o[p])), h = f + 2, f++;
|
|
235
242
|
break;
|
|
236
243
|
case 79:
|
|
237
244
|
// 'O'
|
|
238
245
|
case 111:
|
|
239
246
|
// 'o'
|
|
240
247
|
case 106:
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
var T = typeof
|
|
248
|
+
if (p >= m || o[p] === void 0) break;
|
|
249
|
+
h < f && (b += n.slice(h, f));
|
|
250
|
+
var T = typeof o[p];
|
|
244
251
|
if (T === "string") {
|
|
245
|
-
|
|
252
|
+
b += "'" + o[p] + "'", h = f + 2, f++;
|
|
246
253
|
break;
|
|
247
254
|
}
|
|
248
255
|
if (T === "function") {
|
|
249
|
-
|
|
256
|
+
b += o[p].name || "<anonymous>", h = f + 2, f++;
|
|
250
257
|
break;
|
|
251
258
|
}
|
|
252
|
-
|
|
259
|
+
b += l(o[p]), h = f + 2, f++;
|
|
253
260
|
break;
|
|
254
261
|
case 115:
|
|
255
|
-
if (
|
|
262
|
+
if (p >= m)
|
|
256
263
|
break;
|
|
257
|
-
|
|
264
|
+
h < f && (b += n.slice(h, f)), b += String(o[p]), h = f + 2, f++;
|
|
258
265
|
break;
|
|
259
266
|
case 37:
|
|
260
|
-
|
|
267
|
+
h < f && (b += n.slice(h, f)), b += "%", h = f + 2, f++, p--;
|
|
261
268
|
break;
|
|
262
269
|
}
|
|
263
|
-
++
|
|
270
|
+
++p;
|
|
264
271
|
}
|
|
265
272
|
++f;
|
|
266
273
|
}
|
|
267
|
-
return
|
|
274
|
+
return h === -1 ? n : (h < k && (b += n.slice(h)), b);
|
|
268
275
|
}
|
|
269
|
-
return
|
|
276
|
+
return I;
|
|
270
277
|
}
|
|
271
278
|
var oe;
|
|
272
|
-
function
|
|
279
|
+
function Ve() {
|
|
273
280
|
if (oe) return C.exports;
|
|
274
281
|
oe = 1;
|
|
275
|
-
const t =
|
|
276
|
-
C.exports =
|
|
277
|
-
const r =
|
|
282
|
+
const t = Re();
|
|
283
|
+
C.exports = m;
|
|
284
|
+
const r = be().console || {}, n = {
|
|
278
285
|
mapHttpRequest: A,
|
|
279
286
|
mapHttpResponse: A,
|
|
280
287
|
wrapRequestSerializer: q,
|
|
@@ -282,13 +289,13 @@ function Xe() {
|
|
|
282
289
|
wrapErrorSerializer: q,
|
|
283
290
|
req: A,
|
|
284
291
|
res: A,
|
|
285
|
-
err:
|
|
286
|
-
errWithCause:
|
|
292
|
+
err: G,
|
|
293
|
+
errWithCause: G
|
|
287
294
|
};
|
|
288
|
-
function
|
|
289
|
-
return e === "silent" ? 1 / 0 :
|
|
295
|
+
function o(e, s) {
|
|
296
|
+
return e === "silent" ? 1 / 0 : s.levels.values[e];
|
|
290
297
|
}
|
|
291
|
-
const c = Symbol("pino.logFuncs"), l = Symbol("pino.hierarchy"),
|
|
298
|
+
const c = Symbol("pino.logFuncs"), l = Symbol("pino.hierarchy"), v = {
|
|
292
299
|
error: "log",
|
|
293
300
|
fatal: "error",
|
|
294
301
|
warn: "error",
|
|
@@ -296,101 +303,101 @@ function Xe() {
|
|
|
296
303
|
debug: "log",
|
|
297
304
|
trace: "log"
|
|
298
305
|
};
|
|
299
|
-
function z(e,
|
|
306
|
+
function z(e, s) {
|
|
300
307
|
const a = {
|
|
301
|
-
logger:
|
|
308
|
+
logger: s,
|
|
302
309
|
parent: e[l]
|
|
303
310
|
};
|
|
304
|
-
|
|
311
|
+
s[l] = a;
|
|
305
312
|
}
|
|
306
|
-
function
|
|
313
|
+
function E(e, s, a) {
|
|
307
314
|
const u = {};
|
|
308
|
-
|
|
309
|
-
u[
|
|
315
|
+
s.forEach((g) => {
|
|
316
|
+
u[g] = a[g] ? a[g] : r[g] || r[v[g] || "log"] || F;
|
|
310
317
|
}), e[c] = u;
|
|
311
318
|
}
|
|
312
|
-
function
|
|
319
|
+
function w(e, s) {
|
|
313
320
|
return Array.isArray(e) ? e.filter(function(u) {
|
|
314
321
|
return u !== "!stdSerializers.err";
|
|
315
|
-
}) : e === !0 ? Object.keys(
|
|
322
|
+
}) : e === !0 ? Object.keys(s) : !1;
|
|
316
323
|
}
|
|
317
|
-
function
|
|
324
|
+
function m(e) {
|
|
318
325
|
e = e || {}, e.browser = e.browser || {};
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
326
|
+
const s = e.browser.transmit;
|
|
327
|
+
if (s && typeof s.send != "function")
|
|
321
328
|
throw Error("pino: transmit option must have a send function");
|
|
322
329
|
const a = e.browser.write || r;
|
|
323
330
|
e.browser.write && (e.browser.asObject = !0);
|
|
324
|
-
const u = e.serializers || {},
|
|
325
|
-
let
|
|
326
|
-
Array.isArray(e.browser.serialize) && e.browser.serialize.indexOf("!stdSerializers.err") > -1 && (
|
|
327
|
-
const
|
|
328
|
-
typeof a == "function" &&
|
|
329
|
-
a[
|
|
331
|
+
const u = e.serializers || {}, g = w(e.browser.serialize, u);
|
|
332
|
+
let O = e.browser.serialize;
|
|
333
|
+
Array.isArray(e.browser.serialize) && e.browser.serialize.indexOf("!stdSerializers.err") > -1 && (O = !1);
|
|
334
|
+
const _ = Object.keys(e.customLevels || {}), y = ["error", "fatal", "warn", "info", "debug", "trace"].concat(_);
|
|
335
|
+
typeof a == "function" && y.forEach(function(x) {
|
|
336
|
+
a[x] = a;
|
|
330
337
|
}), (e.enabled === !1 || e.browser.disabled) && (e.level = "silent");
|
|
331
|
-
const
|
|
332
|
-
i.log || (i.log = F),
|
|
338
|
+
const j = e.level || "info", i = Object.create(a);
|
|
339
|
+
i.log || (i.log = F), E(i, y, a), z({}, i), Object.defineProperty(i, "levelVal", {
|
|
333
340
|
get: N
|
|
334
341
|
}), Object.defineProperty(i, "level", {
|
|
335
342
|
get: L,
|
|
336
|
-
set:
|
|
343
|
+
set: ye
|
|
337
344
|
});
|
|
338
345
|
const S = {
|
|
339
|
-
transmit:
|
|
340
|
-
serialize:
|
|
346
|
+
transmit: s,
|
|
347
|
+
serialize: g,
|
|
341
348
|
asObject: e.browser.asObject,
|
|
342
349
|
formatters: e.browser.formatters,
|
|
343
|
-
levels:
|
|
350
|
+
levels: y,
|
|
344
351
|
timestamp: me(e)
|
|
345
352
|
};
|
|
346
|
-
i.levels =
|
|
353
|
+
i.levels = b(e), i.level = j, i.setMaxListeners = i.getMaxListeners = i.emit = i.addListener = i.on = i.prependListener = i.once = i.prependOnceListener = i.removeListener = i.removeAllListeners = i.listeners = i.listenerCount = i.eventNames = i.write = i.flush = F, i.serializers = u, i._serialize = g, i._stdErrSerialize = O, i.child = we, s && (i._logEvent = D());
|
|
347
354
|
function N() {
|
|
348
|
-
return
|
|
355
|
+
return o(this.level, this);
|
|
349
356
|
}
|
|
350
357
|
function L() {
|
|
351
358
|
return this._level;
|
|
352
359
|
}
|
|
353
|
-
function
|
|
354
|
-
if (
|
|
355
|
-
throw Error("unknown level " +
|
|
356
|
-
this._level =
|
|
360
|
+
function ye(x) {
|
|
361
|
+
if (x !== "silent" && !this.levels.values[x])
|
|
362
|
+
throw Error("unknown level " + x);
|
|
363
|
+
this._level = x, k(this, S, i, "error"), k(this, S, i, "fatal"), k(this, S, i, "warn"), k(this, S, i, "info"), k(this, S, i, "debug"), k(this, S, i, "trace"), _.forEach((P) => {
|
|
357
364
|
k(this, S, i, P);
|
|
358
365
|
});
|
|
359
366
|
}
|
|
360
|
-
function
|
|
361
|
-
if (!
|
|
367
|
+
function we(x, P) {
|
|
368
|
+
if (!x)
|
|
362
369
|
throw new Error("missing bindings for child Pino");
|
|
363
|
-
P = P || {},
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
366
|
-
var
|
|
367
|
-
delete
|
|
370
|
+
P = P || {}, g && x.serializers && (P.serializers = x.serializers);
|
|
371
|
+
const Y = P.serializers;
|
|
372
|
+
if (g && Y) {
|
|
373
|
+
var R = Object.assign({}, u, Y), Z = e.browser.serialize === !0 ? Object.keys(R) : g;
|
|
374
|
+
delete x.serializers, $([x], Z, R, this._stdErrSerialize);
|
|
368
375
|
}
|
|
369
|
-
function
|
|
370
|
-
this._childLevel = (
|
|
371
|
-
[].concat(
|
|
376
|
+
function ee(te) {
|
|
377
|
+
this._childLevel = (te._childLevel | 0) + 1, this.bindings = x, R && (this.serializers = R, this._serialize = Z), s && (this._logEvent = D(
|
|
378
|
+
[].concat(te._logEvent.bindings, x)
|
|
372
379
|
));
|
|
373
380
|
}
|
|
374
|
-
|
|
375
|
-
const J = new
|
|
381
|
+
ee.prototype = this;
|
|
382
|
+
const J = new ee(this);
|
|
376
383
|
return z(this, J), J.level = this.level, J;
|
|
377
384
|
}
|
|
378
385
|
return i;
|
|
379
386
|
}
|
|
380
|
-
function
|
|
381
|
-
const
|
|
387
|
+
function b(e) {
|
|
388
|
+
const s = e.customLevels || {}, a = Object.assign({}, m.levels.values, s), u = Object.assign({}, m.levels.labels, p(s));
|
|
382
389
|
return {
|
|
383
390
|
values: a,
|
|
384
391
|
labels: u
|
|
385
392
|
};
|
|
386
393
|
}
|
|
387
|
-
function
|
|
388
|
-
const
|
|
394
|
+
function p(e) {
|
|
395
|
+
const s = {};
|
|
389
396
|
return Object.keys(e).forEach(function(a) {
|
|
390
|
-
|
|
391
|
-
}),
|
|
397
|
+
s[e[a]] = a;
|
|
398
|
+
}), s;
|
|
392
399
|
}
|
|
393
|
-
|
|
400
|
+
m.levels = {
|
|
394
401
|
values: {
|
|
395
402
|
fatal: 60,
|
|
396
403
|
error: 50,
|
|
@@ -407,90 +414,90 @@ function Xe() {
|
|
|
407
414
|
50: "error",
|
|
408
415
|
60: "fatal"
|
|
409
416
|
}
|
|
410
|
-
},
|
|
411
|
-
function
|
|
412
|
-
const
|
|
413
|
-
e.bindings &&
|
|
417
|
+
}, m.stdSerializers = n, m.stdTimeFunctions = Object.assign({}, { nullTime: Q, epochTime: K, unixTime: he, isoTime: pe });
|
|
418
|
+
function h(e) {
|
|
419
|
+
const s = [];
|
|
420
|
+
e.bindings && s.push(e.bindings);
|
|
414
421
|
let a = e[l];
|
|
415
422
|
for (; a.parent; )
|
|
416
|
-
a = a.parent, a.logger.bindings &&
|
|
417
|
-
return
|
|
423
|
+
a = a.parent, a.logger.bindings && s.push(a.logger.bindings);
|
|
424
|
+
return s.reverse();
|
|
418
425
|
}
|
|
419
|
-
function k(e,
|
|
426
|
+
function k(e, s, a, u) {
|
|
420
427
|
if (Object.defineProperty(e, u, {
|
|
421
|
-
value:
|
|
428
|
+
value: o(e.level, a) > o(u, a) ? F : a[c][u],
|
|
422
429
|
writable: !0,
|
|
423
430
|
enumerable: !0,
|
|
424
431
|
configurable: !0
|
|
425
|
-
}), !
|
|
432
|
+
}), !s.transmit && e[u] === F)
|
|
426
433
|
return;
|
|
427
|
-
e[u] = T(e,
|
|
428
|
-
const
|
|
429
|
-
|
|
434
|
+
e[u] = T(e, s, a, u);
|
|
435
|
+
const g = h(e);
|
|
436
|
+
g.length !== 0 && (e[u] = f(g, e[u]));
|
|
430
437
|
}
|
|
431
|
-
function f(e,
|
|
438
|
+
function f(e, s) {
|
|
432
439
|
return function() {
|
|
433
|
-
return
|
|
440
|
+
return s.apply(this, [...e, ...arguments]);
|
|
434
441
|
};
|
|
435
442
|
}
|
|
436
|
-
function T(e,
|
|
437
|
-
return /* @__PURE__ */ (function(
|
|
443
|
+
function T(e, s, a, u) {
|
|
444
|
+
return /* @__PURE__ */ (function(g) {
|
|
438
445
|
return function() {
|
|
439
|
-
const
|
|
440
|
-
for (var i = 0; i <
|
|
441
|
-
if (
|
|
442
|
-
const S =
|
|
446
|
+
const _ = s.timestamp(), y = new Array(arguments.length), j = Object.getPrototypeOf && Object.getPrototypeOf(this) === r ? r : this;
|
|
447
|
+
for (var i = 0; i < y.length; i++) y[i] = arguments[i];
|
|
448
|
+
if (s.serialize && !s.asObject && $(y, this._serialize, this.serializers, this._stdErrSerialize), s.asObject || s.formatters ? g.call(j, de(this, u, y, _, s.formatters)) : g.apply(j, y), s.transmit) {
|
|
449
|
+
const S = s.transmit.level || e._level, N = a.levels.values[S], L = a.levels.values[u];
|
|
443
450
|
if (L < N) return;
|
|
444
|
-
|
|
445
|
-
ts:
|
|
451
|
+
ge(this, {
|
|
452
|
+
ts: _,
|
|
446
453
|
methodLevel: u,
|
|
447
454
|
methodValue: L,
|
|
448
|
-
transmitValue: a.levels.values[
|
|
449
|
-
send:
|
|
450
|
-
val:
|
|
451
|
-
},
|
|
455
|
+
transmitValue: a.levels.values[s.transmit.level || e._level],
|
|
456
|
+
send: s.transmit.send,
|
|
457
|
+
val: o(e._level, a)
|
|
458
|
+
}, y);
|
|
452
459
|
}
|
|
453
460
|
};
|
|
454
461
|
})(e[c][u]);
|
|
455
462
|
}
|
|
456
|
-
function
|
|
463
|
+
function de(e, s, a, u, g = {}) {
|
|
457
464
|
const {
|
|
458
|
-
level:
|
|
459
|
-
log:
|
|
460
|
-
} =
|
|
465
|
+
level: O = () => e.levels.values[s],
|
|
466
|
+
log: _ = (L) => L
|
|
467
|
+
} = g;
|
|
461
468
|
e._serialize && $(a, e._serialize, e.serializers, e._stdErrSerialize);
|
|
462
|
-
const
|
|
463
|
-
let
|
|
469
|
+
const y = a.slice();
|
|
470
|
+
let j = y[0];
|
|
464
471
|
const i = {};
|
|
465
|
-
u && (i.time = u), i.level =
|
|
472
|
+
u && (i.time = u), i.level = O(s, e.levels.values[s]);
|
|
466
473
|
let S = (e._childLevel | 0) + 1;
|
|
467
|
-
if (S < 1 && (S = 1),
|
|
468
|
-
for (; S-- && typeof
|
|
469
|
-
Object.assign(i,
|
|
470
|
-
|
|
471
|
-
} else typeof
|
|
472
|
-
return
|
|
473
|
-
}
|
|
474
|
-
function $(e,
|
|
475
|
-
for (const
|
|
476
|
-
if (u && e[
|
|
477
|
-
e[
|
|
478
|
-
else if (typeof e[
|
|
479
|
-
for (const
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
function
|
|
483
|
-
const u =
|
|
474
|
+
if (S < 1 && (S = 1), j !== null && typeof j == "object") {
|
|
475
|
+
for (; S-- && typeof y[0] == "object"; )
|
|
476
|
+
Object.assign(i, y.shift());
|
|
477
|
+
j = y.length ? t(y.shift(), y) : void 0;
|
|
478
|
+
} else typeof j == "string" && (j = t(y.shift(), y));
|
|
479
|
+
return j !== void 0 && (i.msg = j), _(i);
|
|
480
|
+
}
|
|
481
|
+
function $(e, s, a, u) {
|
|
482
|
+
for (const g in e)
|
|
483
|
+
if (u && e[g] instanceof Error)
|
|
484
|
+
e[g] = m.stdSerializers.err(e[g]);
|
|
485
|
+
else if (typeof e[g] == "object" && !Array.isArray(e[g]))
|
|
486
|
+
for (const O in e[g])
|
|
487
|
+
s && s.indexOf(O) > -1 && O in a && (e[g][O] = a[O](e[g][O]));
|
|
488
|
+
}
|
|
489
|
+
function ge(e, s, a) {
|
|
490
|
+
const u = s.send, g = s.ts, O = s.methodLevel, _ = s.methodValue, y = s.val, j = e._logEvent.bindings;
|
|
484
491
|
$(
|
|
485
492
|
a,
|
|
486
493
|
e._serialize || Object.keys(e.serializers),
|
|
487
494
|
e.serializers,
|
|
488
495
|
e._stdErrSerialize === void 0 ? !0 : e._stdErrSerialize
|
|
489
|
-
), e._logEvent.ts =
|
|
490
|
-
return
|
|
491
|
-
}), e._logEvent.level.label =
|
|
496
|
+
), e._logEvent.ts = g, e._logEvent.messages = a.filter(function(i) {
|
|
497
|
+
return j.indexOf(i) === -1;
|
|
498
|
+
}), e._logEvent.level.label = O, e._logEvent.level.value = _, u(O, e._logEvent, y), e._logEvent = D(j);
|
|
492
499
|
}
|
|
493
|
-
function
|
|
500
|
+
function D(e) {
|
|
494
501
|
return {
|
|
495
502
|
ts: 0,
|
|
496
503
|
messages: [],
|
|
@@ -498,18 +505,18 @@ function Xe() {
|
|
|
498
505
|
level: { label: "", value: 0 }
|
|
499
506
|
};
|
|
500
507
|
}
|
|
501
|
-
function
|
|
502
|
-
const
|
|
508
|
+
function G(e) {
|
|
509
|
+
const s = {
|
|
503
510
|
type: e.constructor.name,
|
|
504
511
|
msg: e.message,
|
|
505
512
|
stack: e.stack
|
|
506
513
|
};
|
|
507
514
|
for (const a in e)
|
|
508
|
-
|
|
509
|
-
return
|
|
515
|
+
s[a] === void 0 && (s[a] = e[a]);
|
|
516
|
+
return s;
|
|
510
517
|
}
|
|
511
518
|
function me(e) {
|
|
512
|
-
return typeof e.timestamp == "function" ? e.timestamp : e.timestamp === !1 ?
|
|
519
|
+
return typeof e.timestamp == "function" ? e.timestamp : e.timestamp === !1 ? Q : K;
|
|
513
520
|
}
|
|
514
521
|
function A() {
|
|
515
522
|
return {};
|
|
@@ -519,21 +526,21 @@ function Xe() {
|
|
|
519
526
|
}
|
|
520
527
|
function F() {
|
|
521
528
|
}
|
|
522
|
-
function
|
|
529
|
+
function Q() {
|
|
523
530
|
return !1;
|
|
524
531
|
}
|
|
525
|
-
function
|
|
532
|
+
function K() {
|
|
526
533
|
return Date.now();
|
|
527
534
|
}
|
|
528
535
|
function he() {
|
|
529
536
|
return Math.round(Date.now() / 1e3);
|
|
530
537
|
}
|
|
531
|
-
function
|
|
538
|
+
function pe() {
|
|
532
539
|
return new Date(Date.now()).toISOString();
|
|
533
540
|
}
|
|
534
|
-
function
|
|
535
|
-
function e(
|
|
536
|
-
return typeof
|
|
541
|
+
function be() {
|
|
542
|
+
function e(s) {
|
|
543
|
+
return typeof s < "u" && s;
|
|
537
544
|
}
|
|
538
545
|
try {
|
|
539
546
|
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
|
|
@@ -546,13 +553,13 @@ function Xe() {
|
|
|
546
553
|
return e(self) || e(window) || e(this) || {};
|
|
547
554
|
}
|
|
548
555
|
}
|
|
549
|
-
return C.exports.default =
|
|
556
|
+
return C.exports.default = m, C.exports.pino = m, C.exports;
|
|
550
557
|
}
|
|
551
|
-
var
|
|
552
|
-
const
|
|
558
|
+
var Xe = Ve();
|
|
559
|
+
const De = /* @__PURE__ */ Ne(Xe), W = De({
|
|
553
560
|
level: process.env.LOG_LEVEL || "info"
|
|
554
561
|
});
|
|
555
|
-
async function
|
|
562
|
+
async function ue() {
|
|
556
563
|
return new Promise((t) => {
|
|
557
564
|
let r = "";
|
|
558
565
|
process.stdin.setEncoding("utf8"), process.stdin.on("data", (n) => {
|
|
@@ -562,7 +569,7 @@ async function fe() {
|
|
|
562
569
|
}), process.stdin.readableEnded && t("");
|
|
563
570
|
});
|
|
564
571
|
}
|
|
565
|
-
async function qe(t, r =
|
|
572
|
+
async function qe(t, r = ue) {
|
|
566
573
|
if (t !== void 0) {
|
|
567
574
|
if (t === "") {
|
|
568
575
|
const n = await r();
|
|
@@ -572,8 +579,8 @@ async function qe(t, r = fe) {
|
|
|
572
579
|
return JSON.parse(t);
|
|
573
580
|
if (Array.isArray(t)) {
|
|
574
581
|
const n = {};
|
|
575
|
-
for (const
|
|
576
|
-
typeof
|
|
582
|
+
for (const o of t)
|
|
583
|
+
typeof o == "string" && Object.assign(n, JSON.parse(o));
|
|
577
584
|
return n;
|
|
578
585
|
}
|
|
579
586
|
if (typeof t == "boolean" && t === !0) {
|
|
@@ -582,32 +589,39 @@ async function qe(t, r = fe) {
|
|
|
582
589
|
}
|
|
583
590
|
}
|
|
584
591
|
}
|
|
585
|
-
async function Je(
|
|
586
|
-
|
|
587
|
-
|
|
592
|
+
async function Je({
|
|
593
|
+
path: t,
|
|
594
|
+
key: r,
|
|
595
|
+
comment: n,
|
|
596
|
+
stringsArg: o,
|
|
597
|
+
stdinReader: c = ue,
|
|
598
|
+
configPath: l
|
|
599
|
+
}) {
|
|
600
|
+
const v = await qe(o, c);
|
|
601
|
+
await Fe(t, r, n, v, l);
|
|
588
602
|
}
|
|
589
|
-
const
|
|
590
|
-
|
|
603
|
+
const ie = X(process.cwd(), "Localizable.xcstrings");
|
|
604
|
+
ve(je(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("config", {
|
|
591
605
|
type: "string",
|
|
592
606
|
describe: "Path to config file"
|
|
593
607
|
}).option("path", {
|
|
594
608
|
type: "string",
|
|
595
609
|
describe: "Path to xcstrings file",
|
|
596
|
-
default:
|
|
610
|
+
default: ie
|
|
597
611
|
}).middleware(async (t) => {
|
|
598
|
-
if (t.path !==
|
|
612
|
+
if (t.path !== ie)
|
|
599
613
|
return;
|
|
600
|
-
const r = await
|
|
614
|
+
const r = await H(t.config);
|
|
601
615
|
if (!(!r || !r.xcstringsPaths || r.xcstringsPaths.length === 0))
|
|
602
616
|
if (r.xcstringsPaths.length === 1) {
|
|
603
617
|
const n = r.xcstringsPaths[0];
|
|
604
618
|
t.path = typeof n == "string" ? n : n.path;
|
|
605
619
|
} else {
|
|
606
|
-
const n = r.xcstringsPaths.map((c) => typeof c == "string" ? { name: c, value: c } : { name: `${c.alias} (${c.path})`, value: c.path }),
|
|
620
|
+
const n = r.xcstringsPaths.map((c) => typeof c == "string" ? { name: c, value: c } : { name: `${c.alias} (${c.path})`, value: c.path }), o = await Ee({
|
|
607
621
|
message: "Select xcstrings file:",
|
|
608
622
|
choices: n
|
|
609
623
|
});
|
|
610
|
-
t.path =
|
|
624
|
+
t.path = o;
|
|
611
625
|
}
|
|
612
626
|
}).command(
|
|
613
627
|
"add",
|
|
@@ -624,7 +638,14 @@ we(ve(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("co
|
|
|
624
638
|
describe: "The strings JSON"
|
|
625
639
|
}),
|
|
626
640
|
async (t) => {
|
|
627
|
-
await Je(
|
|
641
|
+
await Je({
|
|
642
|
+
path: t.path,
|
|
643
|
+
key: t.key,
|
|
644
|
+
comment: t.comment,
|
|
645
|
+
stringsArg: t.strings,
|
|
646
|
+
stdinReader: void 0,
|
|
647
|
+
configPath: t.config
|
|
648
|
+
}), W.info(d.green(`✓ Added key "${t.key}"`));
|
|
628
649
|
}
|
|
629
650
|
).command(
|
|
630
651
|
"remove",
|
|
@@ -635,22 +656,22 @@ we(ve(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("co
|
|
|
635
656
|
demandOption: !0
|
|
636
657
|
}),
|
|
637
658
|
async (t) => {
|
|
638
|
-
await
|
|
659
|
+
await Ce(t.path, t.key), W.info(d.green(`✓ Removed key "${t.key}"`));
|
|
639
660
|
}
|
|
640
661
|
).command(
|
|
641
662
|
"init",
|
|
642
663
|
"Initialize configuration file",
|
|
643
664
|
(t) => t,
|
|
644
665
|
async () => {
|
|
645
|
-
await
|
|
666
|
+
await Ae();
|
|
646
667
|
}
|
|
647
668
|
).command(
|
|
648
669
|
"languages",
|
|
649
670
|
"List supported languages from xcodeproj or xcstrings",
|
|
650
671
|
(t) => t,
|
|
651
672
|
async (t) => {
|
|
652
|
-
const r = await
|
|
653
|
-
|
|
673
|
+
const r = await fe(t.path, t.config);
|
|
674
|
+
W.info(r.join(" "));
|
|
654
675
|
}
|
|
655
676
|
).demandCommand(1, "").strictCommands().recommendCommands().showHelpOnFail(!0).fail((t, r, n) => {
|
|
656
677
|
if (r)
|