@tolgee/cli 2.6.0 → 2.7.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.
@@ -136,5 +136,5 @@ export default (config) => new Command()
136
136
  .addOption(new Option('-l, --languages <languages...>', 'Specifies which languages should be pushed (see push.files in config).').default(config.push?.languages))
137
137
  .addOption(new Option('-n, --namespaces <namespaces...>', 'Specifies which namespaces should be pushed (see push.files in config).').default(config.push?.namespaces))
138
138
  .addOption(new Option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.').default(config.push?.tagNewKeys))
139
- .addOption(new Option('--remove-other-keys', 'Remove keys which are not present in the import.').default(false))
139
+ .addOption(new Option('--remove-other-keys', 'Remove keys which are not present in the import.').default(config.push?.removeOtherKeys))
140
140
  .action(pushHandler(config));
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import ansi from 'ansi-colors';
3
3
  import { extractKeysOfFiles, filterExtractionResult, } from '../../extractor/runner.js';
4
4
  import { dumpWarnings } from '../../extractor/warnings.js';
@@ -113,9 +113,9 @@ const syncHandler = (config) => async function () {
113
113
  export default (config) => new Command()
114
114
  .name('sync')
115
115
  .description('Synchronizes the keys in your code project and in the Tolgee project, by creating missing keys and optionally deleting unused ones. For a dry-run, use `tolgee compare`.')
116
- .option('-B, --backup <path>', 'Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.')
117
- .option('--continue-on-warning', 'Set this flag to continue the sync if warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.')
118
- .option('-Y, --yes', 'Skip prompts and automatically say yes to them. You will not be asked for confirmation before creating/deleting keys.')
119
- .option('--remove-unused', 'Also delete unused keys from the Tolgee project.')
116
+ .addOption(new Option('-B, --backup <path>', 'Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.').default(config.sync?.backup ?? false))
117
+ .addOption(new Option('--continue-on-warning', 'Set this flag to continue the sync if warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.').default(config.sync?.continueOnWarning ?? false))
118
+ .addOption(new Option('-Y, --yes', 'Skip prompts and automatically say yes to them. You will not be asked for confirmation before creating/deleting keys.').default(false))
119
+ .addOption(new Option('--remove-unused', 'Delete unused keys from the Tolgee project.').default(config.sync?.removeUnused ?? false))
120
120
  .option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.')
121
121
  .action(syncHandler(config));
@@ -34,12 +34,12 @@ const tagHandler = (config) => async function () {
34
34
  };
35
35
  export default (config) => new Command('tag')
36
36
  .description('Update tags in your project.')
37
- .addOption(new Option('--filter-extracted', 'Extract keys from code and filter by it.'))
38
- .addOption(new Option('--filter-not-extracted', 'Extract keys from code and filter them out.'))
39
- .addOption(new Option('--filter-tag <tags...>', 'Filter only keys with tag. Use * as a wildcard.'))
40
- .addOption(new Option('--filter-no-tag <tags...>', 'Filter only keys without tag. Use * as a wildcard.'))
41
- .addOption(new Option('--tag <tags...>', 'Add tag to filtered keys.'))
42
- .addOption(new Option('--tag-other <tags...>', 'Tag keys which are not filtered.'))
43
- .addOption(new Option('--untag <tags...>', 'Remove tag from filtered keys. Use * as a wildcard.'))
44
- .addOption(new Option('--untag-other <tags...>', 'Remove tag from keys which are not filtered. Use * as a wildcard.'))
37
+ .addOption(new Option('--filter-extracted', 'Extract keys from code and filter by it.').default(config.tag?.filterExtracted))
38
+ .addOption(new Option('--filter-not-extracted', 'Extract keys from code and filter them out.').default(config.tag?.filterNotExtracted))
39
+ .addOption(new Option('--filter-tag <tags...>', 'Filter only keys with tag. Use * as a wildcard.').default(config.tag?.filterTag))
40
+ .addOption(new Option('--filter-no-tag <tags...>', 'Filter only keys without tag. Use * as a wildcard.').default(config.tag?.filterNoTag))
41
+ .addOption(new Option('--tag <tags...>', 'Add tag to filtered keys.').default(config.tag?.tag))
42
+ .addOption(new Option('--tag-other <tags...>', 'Tag keys which are not filtered.').default(config.tag?.tagOther))
43
+ .addOption(new Option('--untag <tags...>', 'Remove tag from filtered keys. Use * as a wildcard.').default(config.tag?.untag))
44
+ .addOption(new Option('--untag-other <tags...>', 'Remove tag from keys which are not filtered. Use * as a wildcard.').default(config.tag?.untagOther))
45
45
  .action(tagHandler(config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolgee/cli",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "type": "module",
5
5
  "description": "A tool to interact with the Tolgee Platform through CLI",
6
6
  "repository": {
package/schema.json CHANGED
@@ -74,6 +74,10 @@
74
74
  "items": {
75
75
  "type": "string"
76
76
  }
77
+ },
78
+ "removeOtherKeys": {
79
+ "description": "Remove keys which are not present in the import.",
80
+ "type": "boolean"
77
81
  }
78
82
  }
79
83
  },
@@ -136,6 +140,78 @@
136
140
  "type": ["string", "null"]
137
141
  }
138
142
  }
143
+ },
144
+ "sync": {
145
+ "type": "object",
146
+ "properties": {
147
+ "backup": {
148
+ "description": "Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.",
149
+ "type": "string"
150
+ },
151
+ "continueOnWarning": {
152
+ "description": "Continue the sync regardless of whether warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.",
153
+ "type": "boolean"
154
+ },
155
+ "removeUnused": {
156
+ "description": "Delete unused keys from the Tolgee project",
157
+ "type": "boolean"
158
+ }
159
+ }
160
+ },
161
+ "tag": {
162
+ "type": "object",
163
+ "properties": {
164
+ "filterExtracted": {
165
+ "description": "Extract keys from code and filter by it.",
166
+ "type": "boolean"
167
+ },
168
+ "filterNotExtracted": {
169
+ "description": "Extract keys from code and filter them out.",
170
+ "type": "boolean"
171
+ },
172
+ "filterTag": {
173
+ "description": "Filter only keys with tag. Use * as a wildcard.",
174
+ "type": "array",
175
+ "items": {
176
+ "type": "string"
177
+ }
178
+ },
179
+ "filterNoTag": {
180
+ "description": "Filter only keys without tag. Use * as a wildcard.",
181
+ "type": "array",
182
+ "items": {
183
+ "type": "string"
184
+ }
185
+ },
186
+ "tag": {
187
+ "description": "Add tag to filtered keys.",
188
+ "type": "array",
189
+ "items": {
190
+ "type": "string"
191
+ }
192
+ },
193
+ "tagOther": {
194
+ "description": "Tag keys which are not filtered.",
195
+ "type": "array",
196
+ "items": {
197
+ "type": "string"
198
+ }
199
+ },
200
+ "untag": {
201
+ "description": "Remove tag from filtered keys. Use * as a wildcard.",
202
+ "type": "array",
203
+ "items": {
204
+ "type": "string"
205
+ }
206
+ },
207
+ "untagOther": {
208
+ "description": "Remove tag from keys which are not filtered. Use * as a wildcard.",
209
+ "type": "array",
210
+ "items": {
211
+ "type": "string"
212
+ }
213
+ }
214
+ }
139
215
  }
140
216
  },
141
217
  "$defs": {