Christian Fraß commited on 2021-03-04 08:18:19
Zeige 1 geänderte Dateien mit 15 Einfügungen und 5 Löschungen.
... | ... |
@@ -36,7 +36,7 @@ async function main(args : Array<string>) : Promise<void> |
36 | 36 |
{ |
37 | 37 |
const concept_id = parseInt(args.shift()); |
38 | 38 |
const exposal : services.concept.type_exposal = await services.concept.expose(concept_id); |
39 |
- console.info(JSON.stringify(exposal, undefined, "\t")); |
|
39 |
+ console.info(helpers.json.encode_extended(exposal, true, 0)); |
|
40 | 40 |
process.exit(0); |
41 | 41 |
break; |
42 | 42 |
} |
... | ... |
@@ -77,18 +77,21 @@ async function main(args : Array<string>) : Promise<void> |
77 | 77 |
{ |
78 | 78 |
const directory : string = ((args.length >= 1) ? args.shift() : "/tmp"); |
79 | 79 |
const result : Array<services.concept.type_exposal> = await services.concept.export_(); |
80 |
- for await (const exposal of result) |
|
80 |
+ const digits : int = 3; |
|
81 |
+ for (const exposal of result) |
|
81 | 82 |
{ |
82 | 83 |
const path : string = helpers.string.coin |
83 | 84 |
( |
84 | 85 |
"{{directory}}/concept_{{id}}.json", |
85 | 86 |
{ |
86 | 87 |
"directory": directory, |
87 |
- "id": helpers.string.pad_left(exposal.id.toFixed(0), 5, "0"), |
|
88 |
+ "id": helpers.string.pad_left(exposal.id.toFixed(0), digits, "0"), |
|
88 | 89 |
} |
89 | 90 |
); |
90 |
- const content : string = JSON.stringify(result, undefined, "\t"); |
|
91 |
+ delete exposal.id; |
|
92 |
+ const content : string = helpers.json.encode_extended(exposal, true, 0); |
|
91 | 93 |
await helpers.file.write(path, content); |
94 |
+ // console.info(path); |
|
92 | 95 |
} |
93 | 96 |
console.info(directory); |
94 | 97 |
process.exit(0); |
... | ... |
@@ -194,5 +197,12 @@ async function main(args : Array<string>) : Promise<void> |
194 | 197 |
} |
195 | 198 |
|
196 | 199 |
|
197 |
-main(process.argv.slice(2)); |
|
200 |
+main(process.argv.slice(2)) |
|
201 |
+.catch |
|
202 |
+( |
|
203 |
+ (error) => |
|
204 |
+ { |
|
205 |
+ console.error(error.toString()); |
|
206 |
+ } |
|
207 |
+); |
|
198 | 208 |
|
199 | 209 |