@datatruck/cli 0.36.8 → 0.38.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.
Files changed (74) hide show
  1. package/config.schema.json +168 -108
  2. package/lib/actions/BackupAction.d.ts +61 -20
  3. package/lib/actions/BackupAction.js +43 -17
  4. package/lib/actions/CleanCacheAction.d.ts +6 -7
  5. package/lib/actions/CleanCacheAction.js +2 -1
  6. package/lib/actions/ConfigAction.d.ts +3 -5
  7. package/lib/actions/ConfigAction.js +0 -1
  8. package/lib/actions/CopyAction.d.ts +43 -12
  9. package/lib/actions/CopyAction.js +31 -4
  10. package/lib/actions/ExportAction.d.ts +94 -0
  11. package/lib/actions/ExportAction.js +236 -0
  12. package/lib/actions/InitAction.d.ts +17 -7
  13. package/lib/actions/InitAction.js +9 -1
  14. package/lib/actions/PruneAction.d.ts +76 -17
  15. package/lib/actions/PruneAction.js +62 -2
  16. package/lib/actions/RestoreAction.d.ts +61 -22
  17. package/lib/actions/RestoreAction.js +46 -58
  18. package/lib/actions/SnapshotsAction.d.ts +80 -21
  19. package/lib/actions/SnapshotsAction.js +82 -1
  20. package/lib/cli.d.ts +0 -3
  21. package/lib/cli.js +31 -56
  22. package/lib/commands/BackupCommand.d.ts +121 -13
  23. package/lib/commands/BackupCommand.js +29 -54
  24. package/lib/commands/CleanCacheCommand.d.ts +10 -3
  25. package/lib/commands/CleanCacheCommand.js +14 -6
  26. package/lib/commands/CommandAbstract.d.ts +11 -10
  27. package/lib/commands/CommandAbstract.js +6 -9
  28. package/lib/commands/ConfigCommand.d.ts +72 -9
  29. package/lib/commands/ConfigCommand.js +36 -28
  30. package/lib/commands/CopyCommand.d.ts +103 -10
  31. package/lib/commands/CopyCommand.js +25 -44
  32. package/lib/commands/ExportCommand.d.ts +143 -0
  33. package/lib/commands/ExportCommand.js +50 -0
  34. package/lib/commands/InitCommand.d.ts +43 -7
  35. package/lib/commands/InitCommand.js +22 -19
  36. package/lib/commands/PruneCommand.d.ts +237 -17
  37. package/lib/commands/PruneCommand.js +27 -99
  38. package/lib/commands/RestoreCommand.d.ts +127 -13
  39. package/lib/commands/RestoreCommand.js +27 -53
  40. package/lib/commands/RunCommand.d.ts +29 -0
  41. package/lib/commands/RunCommand.js +44 -0
  42. package/lib/commands/SnapshotsCommand.d.ts +240 -23
  43. package/lib/commands/SnapshotsCommand.js +23 -101
  44. package/lib/commands/StartServerCommand.d.ts +10 -3
  45. package/lib/commands/StartServerCommand.js +23 -15
  46. package/lib/repositories/DatatruckRepository.js +1 -1
  47. package/lib/tasks/MssqlTask.js +1 -1
  48. package/lib/tasks/MysqlDumpTask.js +1 -1
  49. package/lib/tasks/SqlDumpTaskAbstract.js +2 -2
  50. package/lib/utils/cli.d.ts +1 -18
  51. package/lib/utils/cli.js +9 -49
  52. package/lib/utils/datatruck/command.d.ts +8 -5
  53. package/lib/utils/datatruck/command.js +8 -4
  54. package/lib/utils/datatruck/config-type.d.ts +4 -0
  55. package/lib/utils/datatruck/cron-server.d.ts +8 -39
  56. package/lib/utils/datatruck/cron-server.js +35 -57
  57. package/lib/utils/datatruck/job.d.ts +41 -0
  58. package/lib/utils/datatruck/job.js +82 -0
  59. package/lib/utils/datatruck/report-list.js +1 -1
  60. package/lib/utils/datatruck/repository.d.ts +1 -0
  61. package/lib/utils/datatruck/repository.js +8 -1
  62. package/lib/utils/list.d.ts +5 -0
  63. package/lib/utils/list.js +9 -0
  64. package/lib/utils/math.js +1 -1
  65. package/lib/utils/object.d.ts +5 -0
  66. package/lib/utils/object.js +10 -1
  67. package/lib/utils/options.d.ts +24 -0
  68. package/lib/utils/options.js +94 -0
  69. package/lib/utils/progress.js +1 -1
  70. package/lib/utils/restic.js +1 -1
  71. package/lib/utils/string.d.ts +2 -1
  72. package/lib/utils/string.js +5 -1
  73. package/lib/utils/watcher.js +1 -1
  74. package/package.json +4 -4
@@ -1,43 +1,51 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigCommand = void 0;
3
+ exports.ConfigCommand = exports.configCommandOptions = void 0;
4
4
  const ConfigAction_1 = require("../actions/ConfigAction");
5
5
  const data_format_1 = require("../utils/data-format");
6
6
  const config_1 = require("../utils/datatruck/config");
7
7
  const string_1 = require("../utils/string");
8
8
  const CommandAbstract_1 = require("./CommandAbstract");
9
+ exports.configCommandOptions = {
10
+ packageNames: {
11
+ description: "Filter by package names",
12
+ shortFlag: "p",
13
+ value: "array",
14
+ },
15
+ packageTaskNames: {
16
+ description: "Filter by package task names",
17
+ shortFlag: "pt",
18
+ value: "array",
19
+ },
20
+ repositoryNames: {
21
+ description: "Filter by repository names",
22
+ shortFlag: "r",
23
+ value: "array",
24
+ },
25
+ repositoryTypes: {
26
+ description: "Filter by repository types",
27
+ shortFlag: "rt",
28
+ value: (string_1.parseStringList),
29
+ },
30
+ };
9
31
  class ConfigCommand extends CommandAbstract_1.CommandAbstract {
10
- optionsConfig() {
11
- return this.castOptionsConfig({
12
- package: {
13
- description: "Filter by package names",
14
- option: "-p,--package <values>",
15
- parser: string_1.parseStringList,
16
- },
17
- packageTask: {
18
- description: "Filter by package task names",
19
- option: "-pt,--package-task <values>",
20
- parser: string_1.parseStringList,
21
- },
22
- repository: {
23
- description: "Filter by repository names",
24
- option: "-r,--repository <values>",
25
- parser: string_1.parseStringList,
26
- },
27
- repositoryType: {
28
- description: "Filter by repository types",
29
- option: "-rt,--repository-type <values>",
30
- parser: (v) => (0, string_1.parseStringList)(v),
31
- },
32
- });
32
+ static config() {
33
+ return {
34
+ name: "config",
35
+ alias: "c",
36
+ options: exports.configCommandOptions,
37
+ };
38
+ }
39
+ get optionsConfig() {
40
+ return exports.configCommandOptions;
33
41
  }
34
42
  async exec() {
35
43
  const result = await ConfigAction_1.ConfigAction.fromGlobalOptionsWithPath(this.globalOptions);
36
44
  const packages = (0, config_1.filterPackages)(result.data, {
37
- packageNames: this.options.package,
38
- packageTaskNames: this.options.packageTask,
39
- repositoryNames: this.options.repository,
40
- repositoryTypes: this.options.repositoryType,
45
+ packageNames: this.options.packageNames,
46
+ packageTaskNames: this.options.packageTaskNames,
47
+ repositoryNames: this.options.repositoryNames,
48
+ repositoryTypes: this.options.repositoryTypes,
41
49
  });
42
50
  const summaryConfig = packages.flatMap((pkg) => ({
43
51
  packageName: pkg.name,
@@ -1,17 +1,110 @@
1
- import { If } from "../utils/ts";
1
+ import { InferOptions } from "../utils/options";
2
2
  import { CommandAbstract } from "./CommandAbstract";
3
- export type CopyCommandOptions<TResolved = false> = {
4
- id?: If<TResolved, string[]>;
5
- last?: number;
6
- package?: If<TResolved, string[]>;
7
- packageTask?: If<TResolved, string[]>;
8
- repository: string;
9
- repository2?: If<TResolved, string[]>;
3
+ export declare const copyCommandOptions: {
4
+ repositoryNames2: {
5
+ description: string;
6
+ shortFlag: string;
7
+ value: "array";
8
+ };
9
+ packageNames: {
10
+ description: string;
11
+ shortFlag: string;
12
+ value: "array";
13
+ };
14
+ packageTaskNames: {
15
+ description: string;
16
+ shortFlag: string;
17
+ value: "array";
18
+ };
19
+ ids: {
20
+ description: string;
21
+ shortFlag: string;
22
+ value: "array";
23
+ };
24
+ last: {
25
+ description: string;
26
+ shortFlag: string;
27
+ value: "number";
28
+ };
29
+ repositoryName: {
30
+ description: string;
31
+ shortFlag: string;
32
+ required: true;
33
+ };
10
34
  };
11
- export declare class CopyCommand extends CommandAbstract<CopyCommandOptions<false>, CopyCommandOptions<true>> {
12
- optionsConfig(): import("../utils/cli").OptionsConfig<CopyCommandOptions<false>, CopyCommandOptions<true>>;
35
+ export type CopyCommandOptions = InferOptions<typeof copyCommandOptions>;
36
+ export declare class CopyCommand extends CommandAbstract<typeof copyCommandOptions> {
37
+ static config(): {
38
+ name: string;
39
+ alias: string;
40
+ options: {
41
+ repositoryNames2: {
42
+ description: string;
43
+ shortFlag: string;
44
+ value: "array";
45
+ };
46
+ packageNames: {
47
+ description: string;
48
+ shortFlag: string;
49
+ value: "array";
50
+ };
51
+ packageTaskNames: {
52
+ description: string;
53
+ shortFlag: string;
54
+ value: "array";
55
+ };
56
+ ids: {
57
+ description: string;
58
+ shortFlag: string;
59
+ value: "array";
60
+ };
61
+ last: {
62
+ description: string;
63
+ shortFlag: string;
64
+ value: "number";
65
+ };
66
+ repositoryName: {
67
+ description: string;
68
+ shortFlag: string;
69
+ required: true;
70
+ };
71
+ };
72
+ };
73
+ get optionsConfig(): {
74
+ repositoryNames2: {
75
+ description: string;
76
+ shortFlag: string;
77
+ value: "array";
78
+ };
79
+ packageNames: {
80
+ description: string;
81
+ shortFlag: string;
82
+ value: "array";
83
+ };
84
+ packageTaskNames: {
85
+ description: string;
86
+ shortFlag: string;
87
+ value: "array";
88
+ };
89
+ ids: {
90
+ description: string;
91
+ shortFlag: string;
92
+ value: "array";
93
+ };
94
+ last: {
95
+ description: string;
96
+ shortFlag: string;
97
+ value: "number";
98
+ };
99
+ repositoryName: {
100
+ description: string;
101
+ shortFlag: string;
102
+ required: true;
103
+ };
104
+ };
13
105
  exec(): Promise<{
14
106
  result: (import("../utils/list").List3SummaryResult | import("../utils/list").Listr3TaskResult<import("../actions/CopyAction").Context>)[];
15
107
  exitCode: number;
108
+ errors: Error[];
16
109
  }>;
17
110
  }
@@ -1,66 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CopyCommand = void 0;
3
+ exports.CopyCommand = exports.copyCommandOptions = void 0;
4
4
  const ConfigAction_1 = require("../actions/ConfigAction");
5
5
  const CopyAction_1 = require("../actions/CopyAction");
6
- const string_1 = require("../utils/string");
7
6
  const CommandAbstract_1 = require("./CommandAbstract");
7
+ exports.copyCommandOptions = {
8
+ ...CopyAction_1.copyActionOptions,
9
+ };
8
10
  class CopyCommand extends CommandAbstract_1.CommandAbstract {
9
- optionsConfig() {
10
- return this.castOptionsConfig({
11
- id: {
12
- option: "-i,--id <ids>",
13
- description: "Filter by identifiers",
14
- parser: string_1.parseStringList,
15
- },
16
- last: {
17
- option: "-l,--last <amount>",
18
- description: "Last snapshots",
19
- parser: Number,
20
- },
21
- package: {
22
- option: "-p,--package <names>",
23
- description: "Filter by package names",
24
- parser: string_1.parseStringList,
25
- },
26
- packageTask: {
27
- option: "-pt,--package-task <values>",
28
- description: "Filter by task names",
29
- parser: string_1.parseStringList,
30
- },
31
- repository: {
32
- option: "-r,--repository <name>",
33
- description: "Filter by repository name",
34
- required: true,
35
- },
36
- repository2: {
37
- option: "-r2,--repository2 <names>",
38
- description: "Filter by repository names",
39
- parser: string_1.parseStringList,
40
- },
41
- });
11
+ static config() {
12
+ return {
13
+ name: "copy",
14
+ alias: "cp",
15
+ options: exports.copyCommandOptions,
16
+ };
17
+ }
18
+ get optionsConfig() {
19
+ return exports.copyCommandOptions;
42
20
  }
43
21
  async exec() {
44
22
  const verbose = this.globalOptions.verbose ?? 0;
45
23
  const config = await ConfigAction_1.ConfigAction.fromGlobalOptions(this.globalOptions);
46
24
  const copy = new CopyAction_1.CopyAction(config, {
47
- ids: this.options.id,
25
+ ids: this.options.ids,
48
26
  last: this.options.last,
49
- packageNames: this.options.package,
50
- packageTaskNames: this.options.packageTask,
51
- repositoryName: this.options.repository,
52
- repositoryNames2: this.options.repository2,
27
+ packageNames: this.options.packageNames,
28
+ packageTaskNames: this.options.packageTaskNames,
29
+ repositoryName: this.options.repositoryName,
30
+ repositoryNames2: this.options.repositoryNames2,
53
31
  verbose: verbose > 0,
54
32
  tty: this.globalOptions.tty,
55
33
  progress: this.globalOptions.progress,
56
34
  });
57
- const result = await copy.exec();
35
+ const data = await copy.exec();
58
36
  if (this.globalOptions.outputFormat)
59
37
  copy
60
- .dataFormat(result, { streams: this.streams, verbose })
38
+ .dataFormat(data.result, {
39
+ verbose,
40
+ streams: this.streams,
41
+ errors: data.errors,
42
+ })
61
43
  .log(this.globalOptions.outputFormat);
62
- const exitCode = result.some((item) => item.error) ? 1 : 0;
63
- return { result, exitCode };
44
+ return data;
64
45
  }
65
46
  }
66
47
  exports.CopyCommand = CopyCommand;
@@ -0,0 +1,143 @@
1
+ import { InferOptions } from "../utils/options";
2
+ import { CommandAbstract } from "./CommandAbstract";
3
+ export declare const exportCommandOptions: {
4
+ repositoryNames: {
5
+ description: string;
6
+ shortFlag: string;
7
+ value: "array";
8
+ };
9
+ repositoryTypes: {
10
+ description: string;
11
+ shortFlag: string;
12
+ value: "array";
13
+ };
14
+ packageNames: {
15
+ description: string;
16
+ shortFlag: string;
17
+ value: "array";
18
+ };
19
+ packageTaskNames: {
20
+ description: string;
21
+ shortFlag: string;
22
+ value: "array";
23
+ };
24
+ tags: {
25
+ description: string;
26
+ shortFlag: string;
27
+ value: "array";
28
+ };
29
+ packageConfig: {
30
+ description: string;
31
+ shortFlag: string;
32
+ };
33
+ id: {
34
+ description: string;
35
+ shortFlag: string;
36
+ required: true;
37
+ };
38
+ outPath: {
39
+ description: string;
40
+ required: true;
41
+ };
42
+ };
43
+ export type ExportCommandOptions = InferOptions<typeof exportCommandOptions>;
44
+ export declare class ExportCommand extends CommandAbstract<typeof exportCommandOptions> {
45
+ static config(): {
46
+ name: string;
47
+ options: {
48
+ repositoryNames: {
49
+ description: string;
50
+ shortFlag: string;
51
+ value: "array";
52
+ };
53
+ repositoryTypes: {
54
+ description: string;
55
+ shortFlag: string;
56
+ value: "array";
57
+ };
58
+ packageNames: {
59
+ description: string;
60
+ shortFlag: string;
61
+ value: "array";
62
+ };
63
+ packageTaskNames: {
64
+ description: string;
65
+ shortFlag: string;
66
+ value: "array";
67
+ };
68
+ tags: {
69
+ description: string;
70
+ shortFlag: string;
71
+ value: "array";
72
+ };
73
+ packageConfig: {
74
+ description: string;
75
+ shortFlag: string;
76
+ };
77
+ id: {
78
+ description: string;
79
+ shortFlag: string;
80
+ required: true;
81
+ };
82
+ outPath: {
83
+ description: string;
84
+ required: true;
85
+ };
86
+ };
87
+ };
88
+ get optionsConfig(): {
89
+ repositoryNames: {
90
+ description: string;
91
+ shortFlag: string;
92
+ value: "array";
93
+ };
94
+ repositoryTypes: {
95
+ description: string;
96
+ shortFlag: string;
97
+ value: "array";
98
+ };
99
+ packageNames: {
100
+ description: string;
101
+ shortFlag: string;
102
+ value: "array";
103
+ };
104
+ packageTaskNames: {
105
+ description: string;
106
+ shortFlag: string;
107
+ value: "array";
108
+ };
109
+ tags: {
110
+ description: string;
111
+ shortFlag: string;
112
+ value: "array";
113
+ };
114
+ packageConfig: {
115
+ description: string;
116
+ shortFlag: string;
117
+ };
118
+ id: {
119
+ description: string;
120
+ shortFlag: string;
121
+ required: true;
122
+ };
123
+ outPath: {
124
+ description: string;
125
+ required: true;
126
+ };
127
+ };
128
+ exec(): Promise<{
129
+ result: (import("../utils/list").List3SummaryResult | import("../utils/list").Listr3TaskResult<{
130
+ snapshots: {
131
+ id: string;
132
+ packages: number;
133
+ };
134
+ task: {
135
+ taskName: string;
136
+ packageName: string;
137
+ };
138
+ export: import("../actions/SnapshotsAction").ExtendedSnapshot;
139
+ }>)[];
140
+ exitCode: number;
141
+ errors: Error[];
142
+ }>;
143
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExportCommand = exports.exportCommandOptions = void 0;
4
+ const ConfigAction_1 = require("../actions/ConfigAction");
5
+ const ExportAction_1 = require("../actions/ExportAction");
6
+ const CommandAbstract_1 = require("./CommandAbstract");
7
+ exports.exportCommandOptions = {
8
+ ...ExportAction_1.exportActionOptions,
9
+ };
10
+ class ExportCommand extends CommandAbstract_1.CommandAbstract {
11
+ static config() {
12
+ return {
13
+ name: "export",
14
+ options: exports.exportCommandOptions,
15
+ };
16
+ }
17
+ get optionsConfig() {
18
+ return exports.exportCommandOptions;
19
+ }
20
+ async exec() {
21
+ const verbose = this.globalOptions.verbose ?? 0;
22
+ const config = await ConfigAction_1.ConfigAction.fromGlobalOptions(this.globalOptions);
23
+ const restore = new ExportAction_1.ExportAction(config, {
24
+ id: this.options.id,
25
+ packageNames: this.options.packageNames,
26
+ packageTaskNames: this.options.packageTaskNames,
27
+ packageConfig: this.options.packageConfig,
28
+ repositoryNames: this.options.repositoryNames,
29
+ repositoryTypes: this.options.repositoryTypes,
30
+ tags: this.options.tags,
31
+ outPath: this.options.outPath,
32
+ verbose: verbose > 0,
33
+ }, {
34
+ tty: this.globalOptions.tty,
35
+ progress: this.globalOptions.progress,
36
+ streams: this.streams,
37
+ });
38
+ const data = await restore.exec();
39
+ if (this.globalOptions.outputFormat)
40
+ restore
41
+ .dataFormat(data.result, {
42
+ verbose,
43
+ streams: this.streams,
44
+ errors: data.errors,
45
+ })
46
+ .log(this.globalOptions.outputFormat);
47
+ return data;
48
+ }
49
+ }
50
+ exports.ExportCommand = ExportCommand;
@@ -1,12 +1,47 @@
1
- import type { RepositoryConfig } from "../utils/datatruck/config-type";
2
- import { If } from "../utils/ts";
1
+ import { InferOptions } from "../utils/options";
3
2
  import { CommandAbstract } from "./CommandAbstract";
4
- export type InitCommandOptions<TResolved = false> = {
5
- repository?: If<TResolved, string[]>;
6
- repositoryType?: If<TResolved, RepositoryConfig["type"][]>;
3
+ export declare const initCommandOptions: {
4
+ repositoryNames: {
5
+ description: string;
6
+ shortFlag: string;
7
+ value: "array";
8
+ };
9
+ repositoryTypes: {
10
+ description: string;
11
+ shortFlag: string;
12
+ value: "array";
13
+ };
7
14
  };
8
- export declare class InitCommand extends CommandAbstract<InitCommandOptions<false>, InitCommandOptions<true>> {
9
- optionsConfig(): import("../utils/cli").OptionsConfig<InitCommandOptions<false>, InitCommandOptions<true>>;
15
+ export type InitCommandOptions = InferOptions<typeof initCommandOptions>;
16
+ export declare class InitCommand extends CommandAbstract<typeof initCommandOptions> {
17
+ static config(): {
18
+ name: string;
19
+ alias: string;
20
+ options: {
21
+ repositoryNames: {
22
+ description: string;
23
+ shortFlag: string;
24
+ value: "array";
25
+ };
26
+ repositoryTypes: {
27
+ description: string;
28
+ shortFlag: string;
29
+ value: "array";
30
+ };
31
+ };
32
+ };
33
+ get optionsConfig(): {
34
+ repositoryNames: {
35
+ description: string;
36
+ shortFlag: string;
37
+ value: "array";
38
+ };
39
+ repositoryTypes: {
40
+ description: string;
41
+ shortFlag: string;
42
+ value: "array";
43
+ };
44
+ };
10
45
  exec(): Promise<{
11
46
  result: {
12
47
  repositoryName: string;
@@ -15,5 +50,6 @@ export declare class InitCommand extends CommandAbstract<InitCommandOptions<fals
15
50
  error: Error | null;
16
51
  }[];
17
52
  exitCode: number;
53
+ errors: Error[];
18
54
  }>;
19
55
  }
@@ -1,36 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InitCommand = void 0;
3
+ exports.InitCommand = exports.initCommandOptions = void 0;
4
4
  const ConfigAction_1 = require("../actions/ConfigAction");
5
5
  const InitAction_1 = require("../actions/InitAction");
6
6
  const cli_1 = require("../utils/cli");
7
7
  const data_format_1 = require("../utils/data-format");
8
- const string_1 = require("../utils/string");
8
+ const error_1 = require("../utils/error");
9
9
  const CommandAbstract_1 = require("./CommandAbstract");
10
+ exports.initCommandOptions = {
11
+ ...InitAction_1.initActionOptions,
12
+ };
10
13
  class InitCommand extends CommandAbstract_1.CommandAbstract {
11
- optionsConfig() {
12
- return this.castOptionsConfig({
13
- repository: {
14
- description: "Filter by repository names",
15
- option: "-r,--repository <values>",
16
- parser: string_1.parseStringList,
17
- },
18
- repositoryType: {
19
- description: "Filter by repository types",
20
- option: "-rt,--repository-type <values>",
21
- parser: (v) => (0, string_1.parseStringList)(v),
22
- },
23
- });
14
+ static config() {
15
+ return {
16
+ name: "init",
17
+ alias: "i",
18
+ options: exports.initCommandOptions,
19
+ };
20
+ }
21
+ get optionsConfig() {
22
+ return exports.initCommandOptions;
24
23
  }
25
24
  async exec() {
26
25
  const verbose = this.globalOptions.verbose ?? 0;
27
26
  const config = await ConfigAction_1.ConfigAction.fromGlobalOptions(this.globalOptions);
28
27
  const init = new InitAction_1.InitAction(config, {
29
- repositoryNames: this.options.repository,
30
- repositoryTypes: this.options.repositoryType,
28
+ repositoryNames: this.options.repositoryNames,
29
+ repositoryTypes: this.options.repositoryTypes,
31
30
  verbose: verbose > 0,
32
31
  });
33
32
  const result = await init.exec();
33
+ const exitCode = result.some((item) => item.error) ? 1 : 0;
34
+ const errors = result
35
+ .filter((item) => item.error && (verbose || !(item.error instanceof error_1.AppError)))
36
+ .map(({ error }) => error);
34
37
  const dataFormat = new data_format_1.DataFormat({
35
38
  streams: this.streams,
36
39
  json: result,
@@ -47,13 +50,13 @@ class InitCommand extends CommandAbstract_1.CommandAbstract {
47
50
  item.repositoryName,
48
51
  item.repositoryType,
49
52
  item.repositorySource,
50
- (0, cli_1.renderError)(item.error, verbose),
53
+ (0, cli_1.renderError)(item.error, errors.indexOf(item.error)),
51
54
  ]),
52
55
  },
53
56
  });
54
57
  if (this.globalOptions.outputFormat)
55
58
  dataFormat.log(this.globalOptions.outputFormat);
56
- return { result, exitCode: 0 };
59
+ return { result, exitCode, errors };
57
60
  }
58
61
  }
59
62
  exports.InitCommand = InitCommand;